PDA

View Full Version : Redirect a Subdomain to Point to a Subdirctory


cachevalley
09-09-2011, 09:13 AM
I know there is answer to this in the KB, however I'm still not understanding how exactly I am supposed to do this.

My subdomain is www.cachevalleyparadeofhomes.com and I would like to point it to www.cvhba.com/parade_of_homes.html. The help in the KB says to place the following code in a default document on the document root. I am new to this and don't totally understand what all of this means so my questions are below.

<%
If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain1.YourHostedDomainName.com") ) > 0 Then
Response.Redirect("/subdomain1")
ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain2.YourHostedDomainName.com") ) > 0 Then
Response.Redirect("/subdomain2")
ElseIf InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain3.YourHostedDomainName.com") ) > 0 Then
Response.Redirect("/subdomain3/home.asp")
End If
%>

1. Do I just make a new default.html document or add it to my index.html? If adding it to index.html, where do I add it to the code?
2. What do I put in as the SERVER_NAME?
3. What do I put for the subdomain1.YourHostedDomainName.com for sure? Is it www.cachevalleyparadeofhomes.cvhba.com?
4. Does /subdomain1 = /www.cvhba.com/parade_of_homes.html?
5. What do I put for all the other subdomain#'s?

Again, I apologize for all of the questions, but I appreciate any help I can get.

Thanks,
Melissa

jayc
09-09-2011, 12:00 PM
<%
If InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("cachevalleyparadeofhomes.cvhba.com") ) > 0 Then
Response.Redirect("/parade_of_homes.html")
End If
%>

Copy and paste it to your notepad, save as ASCII text with .aspx extension name it as default.aspx (see the default document tab in IIS tool within the control panel. The first line in the box is your default document)