My website has two urls that go to the same page.
(www.mysite.com & www.myothersite.com)
how can i make a redirection script so that anyone who types in www.mysite.com will get redirected to www.myothersite.com?
thanks in advance, Jon
in the "index.php" file of www.mysite.com:
<? header ('location: http://www.myothersite.com') ?>
make sure this is the first line of the file (no spaces before)
there are a few ways u can do that, u could do it in javascript, a frameset, server side languages or htaccess
the index.php file of www.mysite.com is the same file as www.myothersite.com
i need some kind of script that says:
if current location is www.mysite.com then redirect to www.myothersite.com
do you know of such a script?
thanks, Jon
Along the same lines as devin's snippet, you could just add a check for what site the user is browsing from such as:
<?php if(strstr($HTTP_SERVER,"mysite.com")) { header("Location: http://www.myothersite.com"); } ?>
-Josh
thanks guys.
this what i went with: <? if ($HTTP_HOST == "mysite.com") { header ('location: http://www.myothersite.com'); } ?>