HTTP Status codes and how to trigger them in PHP

March 10th, 2009 - by admin

I will be adding all the codes to this post but for now here is how to do a php 301 redirect

PHP 301 Redirect

If you have upgraded your website and renamed some of your files, make sure you don’t get any 404 error’s – Google will punish you for it!

simply put the following lines of code at the old location:

header(“HTTP/1.1 301 Moved Permanently”);
header(“Location: http://www.yourdomain.com/newpage.php”);
exit();