Well instead of htaccess, I am looking to redirect some of my webpages using php. So I want to redirect www.example.com/old.php to www.example.com/new.php by putting the php code in old.php. All help/code will be appreciated. Is this the best Code to use for php redirection ? <? Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: http://www.new-url.com" ); ?> Code (markup):
Yes. Just keep in mind that the "h" in "header" should not be capitalized. And you could also do it this way: header('Location: http://new-url.com', true, 301); PHP: