Click to See Complete Forum and Search --> : redirecting based on web address


jigidyjim
09-07-2003, 10:27 PM
Hello, I have two domain names, call them www.a.com and www.b.com, but only one web host. The web host says I cannot have the two names point to different areas on the server without some complicated billing thing that I don't understand.

What I'd like to do is use javascript to redirect the user to a specific page depending on what address they are trying to reach.

For example:

http://www.a.com would go to what is currently www.a.com.

But if the user tried to go to
http://www.b.com, the javascript would ideally rerout the user to http://www.a.com/bpage.html instead of http://www.a.com which is what it currently does.

Is this possible and reliable?

Khalid Ali
09-08-2003, 07:40 AM
I don't think JavaScript can do that,its the web server that you may need to configure for this or change a DNS entry in your domain name server......

BigJim96
01-17-2008, 03:42 PM
<script type="text/javascript">

if (window.location.href.indexOf("b.com") != -1)
{
location.replace("http://www.a.com/bpage.html")
}
else if (window.location.href.indexOf("c.com") != -1)
{
location.replace("http://www.a.com/cpage.html")
}
else
{
location.replace("http://www.a.com/badpage.html")
}
// -->
</script>

LeeU
01-17-2008, 03:45 PM
The only problem would be if the person doesn't have JS turned-on. Do you have access to your .htaccess file?