301 Permanent redirects in PHP
I recently moved my site from PHP over to ColdFusion, and this gave me a nice warm fluffy feeling. However, some of the articles I posted actually received a fair amount of traffic, so I had to leave a few php pages in the system and ask them to redirect to the new and improved ColdFusion based pages. PHP has a pretty nice system of being able to manipulate headers and make a redirect with a specific code. So these pages needed to be a specific http code to force search engines and the like to update their cache and indexes. For this purpose a 301 http status code should be sent. The 301 status code is used to indicate that a page has permanently moved:
Here we send the browser a header of 301, to say this page is gone, and please now replace it with the URL in the next line. In this case I am dealing with the errors produced by /products/item.php and passing through the Amazon ASIN id of the product to make sure the user gets the new version of that same page. This will stop my webserver logs being clogged up with 404 errors.