Though I briefly talked about this in another post, I use this so often I thought it deserved a post of its own.
To send this particular header, simply put this PHP code before there’s any output to the page:
<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.somesite/some-page/");
?>
If you’re using Apache, you can also do this in an .htaccess file. But sometimes this is easier.
Why Use 301 Headers?
First off, there’s the benefit to your visitors - this will shoot them over to the updated page right away. But the real benefit of using this type of header is that is lets search engines know that this is a permanent change of location for this page, and that they should update their records accordingly. Thus, the new location of the page will start showing up sooner than later in search engine result pages (SERPs), and you’ll stand a better chance of retaining some page rank.
Cheers!
Leave a comment