Lets say I change my domain to newsite.com from dancingwithross.com. So how can I get dancingwithross.com/index.php/pagetitle=nightclub to redirect to newsite.com/index.php/pagetitl e=nightclub ? This I want to do because a login has to be done separately on both, and needing to change thousands of links to the new domain, so redirection would be easier.
<?php
header("Location: http://newsite.com" . $_SERVER['REQUEST_URI']);
?>
![]()
Would this work, for say a PHPBB forum? Where both domains are tied to the same exact host?
Would this work, for say a PHPBB forum? Where both domains are tied to the same exact host?
The REQUEST_URI statement returns everything after (and including) the "/", so it will work for any page, provided that code snippet is on it. I know there's also a way to do it with .htaccess, but I'm not very good with that, so Ross will probably have to help you out with that.![]()
Surely that'd constantly loop, an IF statement is required!![]()
Surely that'd constantly loop, an IF statement is required!![]()
From what I understand, he will have two copies of the site. If he is running both sites off the exact same files, then yes, he will need an if statement.![]()
If I misunderstood, though, you would need this code:
<?php
if($_SERVER['SERVER_NAME'] == "www.oldsite.com")
{
header("Location: http://newsite.com" . $_SERVER['REQUEST_URI']);
}
?>
Surely that'd constantly loop, an IF statement is required!![]()
From what I understand, he will have two copies of the site. If he is running both sites off the exact same files, then yes, he will need an if statement.![]()
If I misunderstood, though, you would need this code:
<?php
if($_SERVER['SERVER_NAME'] == "www.oldsite.com")
{
header("Location: http://newsite.com" . $_SERVER['REQUEST_URI']);
}
?>
That works! Thank's marc!