Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with a redirect

Status
Not open for further replies.

piratefan

Programmer
Jul 20, 2003
195
US
I am trying to do the following. I have two domains. Domain1.com and Domain2.com. Both are hosted with different companies. I want to put Domain2.com with the same host as Domain1.com, as a subdirectory. I am having trouble with the coding.
<%

sname = Request.ServerVariables(&quot;SERVER_NAME&quot;)

sname = ucase(sname)

if InStr(sname,&quot;DOMAIN1.COM&quot;) <> 0 then

response.redirect &quot;/subdir/home.aspx&quot;

else

response.redirect &quot;homepage.aspx&quot;

end if

%>

Now first off, I am not sure if &quot;DOMAIN1.COM&quot; is what I should be using with the InStr. Also, my homepage.aspx is the page Domain1 users default to.
The code at the top of homepage.aspx begins with several import statements. Like <%@ Page Language=&quot;VB&quot; %> etc.
I try putting the code after those statements and before my <script> tag. When I save it, the code is put after the <body> tag.
I hope I am not too confusing. I want users that want Domain1.com to go to homepage.aspx. Those wanting Domain2.com to go to /subdir/home.aspx.
Thanks for any help.

 
<%
If InStr( UCase(Request.ServerVariables(&quot;SERVER_NAME&quot;)), UCase(&quot;DOMAIN2.COM&quot;) ) > 0 Then
Response.Redirect(&quot;Else If InStr( UCase(Request.ServerVariables(&quot;SERVER_NAME&quot;)), UCase(&quot; ) > 0 Then
Response.Redirect(&quot;End if
%>
Maybe someone can help with this. This thing has a mind of its own. Sometimes, when submitting domain2.com, it will redirect where I want it. Sometimes, it goes to domain1.com. Anyone have any idea what I am doing wrong?
Thanks.
 
One other thing that I am looking at. My homepage.aspx, which is in domain1.com, is cached. Could this be my problem and if so, how can I handle it?
Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top