HighDots Forums  

Re: Conditional URL Redirection...

alt.html.dhtml alt.html.dhtml


Discuss Re: Conditional URL Redirection... in the alt.html.dhtml forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
TC
 
Posts: n/a

Default Re: Conditional URL Redirection... - 04-25-2004 , 11:43 AM






Thanks for your replies. They are very helpful.

I was away for the last while....so didn't reply to the group until now.
Here is the solution I use:

Assuming I have 3 domains. domain-a.com, domain-b.com, domain-c.com all
resolve to the same server ip at the DNS level (in fact, same directory
location due to the restriction of the ISP; otherwise, I didn't have to use
this script...it's better to do it at the DNS level).

domain-a is kept at the root level. domain-b.com & domain-c.com are saved on
2 seperated sub-directories (named as its domain name) and their home page
are called "index.htm"

Save the text below as "default.asp":
(Note: IIS by default looks for "default.htm" first, then "default.asp",
then "index.htm" etc. so make sure there is no "default.htm" on the server.
Of course, IIS can be re-configured if you have access to the server.)
----------------------------------------------------------------------------
---------------------
<%@ Language=VBScript %>
<%
Dim sURL

sURL = Request.ServerVariables("HTTP_HOST")

Select Case sURL
Case "www.domain-a.com", "domain-a.com"
Response.Redirect "http://www.domain-a.com/index.htm"

Case "www.domain-b.com", "domain-b.com"
Response.Redirect "http://www.domain-b.com/domain-b"

Case "www.domain-c.com", "domain-c.com"
Response.Redirect "http://www.domain-c.com/domain-c"
End Select
%>
----------------------------------------------------------------------------
---------------------


TC


"TC" <mr2_93 (AT) hotmail (DOT) com> wrote

Quote:
Hi all,

I wonder if someone can help me with this:

- I have multiple domains (e.g. a.com, b.com & c.com) and my ISP doesn't
support custom DNS so I end up having all domains pointing to the same
location.

- What's the best way to handle the domain redirection according the url
from the visitor browsers. For example, if users request a.com, my codes
should redirect them to http://a.com/a.htm. For b.com, they would be
redirected to http://a.com/b.htm etc.

Your help is greatly appreciated!!! Thanks.


T.





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.