Link to home
Start Free TrialLog in
Avatar of Northumberland
Northumberland

asked on

Help re-directing web pages

If you have a server running IIS, can I have a default asp or html page that does something depending upon the URL the user typed into IE to access it.  For example, if the user typed http://server.xyz.com the page does nothing.  If the user typed http://owa.xyz.com the page would re-direct the user to http://owa.xyz.com/exchange

Both http://server.xyz.com   and http://owa.xyz.com point to the same IIS IP address.

Avatar of amit_g
amit_g
Flag of United States of America image

You could do it in IIS based on Host Header. Create a new site with same IP and same port but with a diffent host header (http://owa.xyz.com) and the home directory of it could be set as exchange. So http://owa.xyz.com would work exactly as http://owa.xyz.com/exchange is working now.

If you want to do it as it is now with help of default.asp redirect then use this code in defaut.asp

If (LCase(Request.ServerVariables("HTTP_HOST")) = "owa.xyz.com") Then
    Call Response.Redirect("exchange")
End If
Avatar of Northumberland
Northumberland

ASKER

I know this is going to be a stupid question, but I dont know much about asp.  I took the code and pasted it into wordpad and saved it as Default.asp.  I placed it under the wwwroot directory.

When I type http://server.xyz.com   It just displays the code as text.  

Also where do I fing the host headers ?
ASKER CERTIFIED SOLUTION
Avatar of amit_g
amit_g
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Northumberland,
    as u said u created file with default.asp and put it in <drive>:\Inetpub\wwwroot directory, if it is your local machine and u running application from this then it is not possible to test it on local machine bcoz it is defined as "localhost" so your url to access page should be
if you store your default page in <drive>:\Inetpub\wwwroot then http://localhost/default.asp 
if you store your default page in  <drive>:\Inetpub\wwwroot\test then http://localhost/test/default.asp 

like that.
you should first deploy on remote machine. if this is the case.