301 redirect issues

mgtarheels

New member
Sep 9, 2010
1,344
7
0
I'm trying to 301 certain pages on old domain to similar/same pages to a new domain, but not trying to redirect the entire domain and content. I also need to redirect the homepage to the new site. Does anyone know how to do that without redirecting the entire domain? I know I need separate rules and to not use wildcards, but the shit im trying isnt working.

tumblr_m7nw7uGnj71r2crwso1_500.jpg
 


By the beard of Zeus. Okay look, redirect everything but the root with .htaccess. In the root create index.php and place this code in it:

<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://newdomain.com" );
?>

That will 301 anyone who hits the root.
 
By the beard of Zeus. Okay look, redirect everything but the root with .htaccess. In the root create index.php and place this code in it:

<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://newdomain.com" );
exit;
?>

That will 301 anyone who hits the root.

Although that'll work if there is no other code on the page, if there is other code on the page place exit; after it. Otherwise code will keep executing on the page while the redirect is going on, and the redirect won't happen right away.