Jun
03
2008

301 Permanent Redirect PHP and HTACCESS

Just to compare two of the different ways to effectively do a proper redirect...

PHP:
(old.php)

<?
header ('HTTP/1.1 301 Moved Permanently');
header('Location: http://kevinsmithdesigns.com/new.php');
exit;
?>

.HTACCESS

 
Redirect 301 /old.php http://www.kevinsmithdesigns.com/new.php
 

--------------
I much prefer .htaccess so you can delete old.php and keep track of all redirects via one file (.htaccess).
.htaccess is also probably the safest way to redirect (if you're the SEO conscious type)

Written by Kevin in: PHP, WebDev |

No Comments »

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes