Click to See Complete Forum and Search --> : redirect depending on..


Gary
05-01-2003, 06:45 AM
Hi all,


I need to be able to check the URL address of the web browser and if it matches an address redirect to a folder on my site

I have 3 domain names all pointing to 1 bit of webspace...

For each domain name i would like to point them to a different folder on my web space...

Any code would be much appreciated..

pyro
05-01-2003, 07:12 AM
Try something like this:

<script language="javascript" type="text/javascript">

url = top.location;
urlhost = url.host;
if (urlhost == "www.yourfirstdomain.com") {
window.location.href = "http://www.yourdomain.com/somepage.htm";
}
else if (urlhost == "www.yourseconddomain.com") {
window.location.href = "http://www.yourdomain.com/somepage2.htm";
}
else {
window.location.href = "http://www.yourdomain.com/somepage3.htm";
}
</script>

Gary
05-01-2003, 07:29 AM
Brilliant..works perfectly Thanks alot :)

pyro
05-01-2003, 08:06 AM
Your welcome!