Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q1231 How can I redirect the user to different start pages if there are two domain names pointing to the same web?

irt.org | Knowledge Base | JavaScript | Redirect | Q1231 [ previous next ]

Q1231 How can I redirect the user to different start pages if there are two domain names pointing to the same web?

In index.html on the server have:

<html>
<head>
<title>Redirection...</title>
<script language="JavaScript"><!--
var loc = window.location.href;
var server1 = 'fox.com';
var server2 = 'fox.org';
var newLoc = 'error.html';

if (loc.toLowerCase().indexOf(server1) !=-1)
    newLoc = 'foxcom.html';
else if (loc.toLowerCase().indexOf(server2) !=-1)
    newLoc = 'foxorg.html';

document.write('Please stand by, redirecting to another page');

/* Use setTimeout to allow the user to use the back button */

if (document.images)
    setTimeout('window.location.replace(newLoc)',2000);
else
    setTimeout('window.location = newLoc',2000);
//--></script>
</head>

<body>
You will be redirected in a few seconds.
If not, please click one of the following:
<a href="domain1.htm">www.domain1.com</a>
<a href="domain2.htm">www.domain2.com</a>
</body>
</html>

Feedback on 'Q1231 How can I redirect the user to different start pages if there are two domain names pointing to the same web?'


Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.