Go Back   Velocity Reviews > Newsgroups > HTML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

HTML - Re: Conditional URL Redirection...

 
Thread Tools Search this Thread
Old 04-25-2004, 04:43 PM   #1
Default Re: Conditional URL Redirection...


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" <> wrote in message
news:Qr5ac.19323$ ble.rogers.com...
> 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.
>
>





TC
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Forum Jump