PDA

View Full Version : Subdomain Problem


itmanmike
03-30-2009, 06:57 AM
I'm trying to get a subdomain to redirt to a specific page name _
ie: http://subdomain.domainname.com/folder/page.aspx. host says to use the following code but i'm not sure how to change some of the code and once i cahnge the code where do i put it?

<%
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
%>

do i change all 3 lines? also what is the SERVER_NAME and do i change it?

thank for any help.
mike

raymondp
03-30-2009, 07:13 AM
Mike,

It all depends on how many subdomain names you are trying to cover. If you only have one subdomain name you will need to modify the code to read....

<%
InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain1.YourHostedDomainName.com") ) > 0 Then Response.Redirect("/subdomain1")
%>

itmanmike
05-13-2009, 11:05 AM
<%
InStr( UCase(Request.ServerVariables("SERVER_NAME")), UCase("subdomain1.YourHostedDomainName.com") ) > 0 Then Response.Redirect("/subdomain1")
%>

i added the code to the website and it didn't work. does this code in the head or the body. we are using aspx, i added it to the default page. the default.aspx (for the subdomain) page i have sitting in a folder in the root directory. make any sense?
thanks for any help.

Chuck
05-13-2009, 02:17 PM
What do you mean by didnt work? Also, what did you replace the in the statement and where exactly is the file?