2 Domains go to one Website - How to redirect one?

M

Mr B

Howdy all,

I have 2 domain names that both go to the same website. For example, if www.XXXX.com is the primary
name for the website, if you type in www.XXXX.com or www.YYYY.com, they both go www.XXXX.com for the
same website jsut via different names.

What I want to do is take one of those, and redirect them to a sub folder. So if someone goes to
www.XXXX.com they just go to the normal Index page. But if someone goes to www.YYYY.com, they go to
the index page which would do a check to see where they tried to go, and would redirect them to
www.XXXX.com/folder

Is there any way to do this via Javascript?

Thanks.
 
M

Matt Herson

Mr B said:
Howdy all,

I have 2 domain names that both go to the same website. For example, if
www.XXXX.com is the primary
name for the website, if you type in www.XXXX.com or www.YYYY.com, they
both go www.XXXX.com for the
same website jsut via different names.

What I want to do is take one of those, and redirect them to a sub folder. So if someone goes to
www.XXXX.com they just go to the normal Index page. But if someone goes
to www.YYYY.com, they go to
the index page which would do a check to see where they tried to go, and would redirect them to
www.XXXX.com/folder

Is there any way to do this via Javascript?

Thanks.

I have been using an asp page to handle something similar to this. Remane
your index.htm page of www.xxxx.com to index.asp. Then the contents below
will handle the redirect. Try something like this:


<%
dim serverName
serverName = request.ServerVariables("SERVER_NAME")
if inStr(1,serverName,"xxxx.com",1)>0 then
response.Redirect(www.xxxx.com/home.htm)
elseif inStr(1,serverName,yyyy.com,1)>0 then
response.Redirect(www.xxxx.com/folder)
else
response.Write("You came to unknown domain. Please choose one of the
following:<br>")
response.Write("<a
href='http://www.xxxx.com>http://www.xxxx.com</a><br>")
response.Write("<a
href='http://www.yyyy.com'>http://www.yyyy.com</a><br>")
end if
%>
 
M

Mr B

What do I put in where you wrote "SERVER_NAME" below? or do I just leave it exactly like that? If
not, do I just put in www.xxxx.com or something else?
 
I

Inforassist.com

You don't need to redirect the second domain, you can you pointed ou parked
domains
regards
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top