ashkir Full Member
  
![[Avatar]](http://uploads.virtualforums.co.uk/forums/support/W9M-tej.gif) Posts: 1,159 Status: Offline Gender: Male Location: Cali! Age: 36 Joined:
pmskypemsnyahoo | Domain Change Redirection (15th Jan 10 at 10:51am UTC) | | 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/pagetitle=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. | |
|
Marc vChat Developer
     I <3 Rossy
Posts: 3,388 Status: Offline Gender: Male Location: Ontario, Canada Age: 32 Joined:
Additional Groups: Coding Team
  
pmwww | Re: Domain Change Redirection (15th Jan 10 at 11:29pm UTC) | | <?php
header("Location: http://newsite.com" . $_SERVER['REQUEST_URI']);
?>
| |
rroll.to— Shorten a link, rickroll your friends. |
|
ashkir Full Member
  
![[Avatar]](http://uploads.virtualforums.co.uk/forums/support/W9M-tej.gif) Posts: 1,159 Status: Offline Gender: Male Location: Cali! Age: 36 Joined:
pmskypemsnyahoo | Re: Domain Change Redirection (16th Jan 10 at 1:14am UTC) | | Would this work, for say a PHPBB forum? Where both domains are tied to the same exact host? | |
|
Marc vChat Developer
     I <3 Rossy
Posts: 3,388 Status: Offline Gender: Male Location: Ontario, Canada Age: 32 Joined:
Additional Groups: Coding Team
  
pmwww | Re: Domain Change Redirection (16th Jan 10 at 2:03am UTC) | | 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. | |
rroll.to— Shorten a link, rickroll your friends. |
|
Michael Moderator
    
![[Avatar]](http://av.wservices.co.uk/av.png) Recoding the future Posts: 4,043 Status: Offline Gender: Male Location: UK Joined:
Additional Groups: Coding Team
  
pmvForum | Re: Domain Change Redirection (16th Jan 10 at 3:49am UTC) | |
Surely that'd constantly loop, an IF statement is required!
| |
|
Marc vChat Developer
     I <3 Rossy
Posts: 3,388 Status: Offline Gender: Male Location: Ontario, Canada Age: 32 Joined:
Additional Groups: Coding Team
  
pmwww | Re: Domain Change Redirection (16th Jan 10 at 7:56pm UTC) | | 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']);
} ?> | |
rroll.to— Shorten a link, rickroll your friends. |
|
ashkir Full Member
  
![[Avatar]](http://uploads.virtualforums.co.uk/forums/support/W9M-tej.gif) Posts: 1,159 Status: Offline Gender: Male Location: Cali! Age: 36 Joined:
pmskypemsnyahoo | Re: Domain Change Redirection (19th Jan 10 at 1:54pm UTC) | | 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! | |
|