PHP Permanently Move A Page

Posted on March 1, 2008 by admin.
Categories: SEO.

The proper way to move a page and have search engines properly find it is to use a 301 redirect. The 301 redirect tells the search engines that “this page has permanently moved”. I am in the process of redirecting an entire website using 301 redirects, and I will post updates on the impact this has on the SEO and search engine placement on the site. The code to do a 301 redirect in php is as follows:

<?php

// Permanent redirection

header("HTTP/1.1 301 Moved Permanently");

header("Location: http://www.somacon.com/");

exit();
?>

Be sure you put the line : header(”HTTP/1.1 301 Moved Permanently”); Because as I have recently discovered, just using the header location line does a 302 redirect instead of a 301.  A 302 redirect tells the search engines that “this page has temporarily moved”.  So be sure you do this correctly if the page is permanently moving.

del.icio.us Slashdot Digg Facebook Technorati StumbleUpon Yahoo Ask

2 comments.