I want to redirect www.domain.com/forums to forums.domain.com and also dont want to lose my visitors from SE i tries using <?php $URL="http://www.forums.mysite.com/"; header ("Location: $URL"); ?> Code (markup): but it just redirects www.domain.com/forums to forums.domain.com and not www.mysite.com/forums/forumdisplay.php?f=2 to forums.mysite.com/forumdisplay.php?f=2 or www.mysite.com/forums/showthread.php?t=2835 to forums.mysite.com/showthread.php?t=2835 How do i get the later two working...
You should create .htaccess file and put there: RewriteEngine On RewriteRule ^/forums/(.*) http://forums.mysite.com/$1 [R,L]
Or you can use this php code: <?php $URL=preg_replace("/^\/forums\/(.+)/", "http://forums.mysite.com/$1", $_SERVER['REQUEST_URI']); header ("Location: $URL"); ?>