PHP Tutorial > PHP Commands > Redirect
If you have moved your pages, you can use PHP to perform a redirect to your new page.
The search engine friendly way of redirecting is the 301 redirect. In PHP, this is implemented as follows:
Header("HTTP/1.1 301 Moved Permanently");
Make sure the above code is included before any HTML is produced. Otherwise, the redirect will not work.
A 301 redirect directs the search engine spiders to the new page, and ensures that all link juices to your old page are all passed to the new page.
Please note that if you do not include the first Header line above, the redirect still works. But, instead of a 301 redirect, now it becomes a 302 (temporary) redirect. 302 redirects are not search engine friendly, as it has become a common spam technique. So, if you want to ensure your search engine ranking is not affected by moving your file elsewhere or changing your file name, make sure you set up a 301 redirect.
Next: PHP MySQL