HOME  |  AJAX  |  SOLUTIONS  |  TECHNOLOGIES  |  E-COMMERCE  |  ABOUT US
404 Error Pages
I learned something today about creating custom error pages.  I finally launched a site that I had been working on for quite sometime yesterday, and I realized that all of the legacy links would end up pointing to nowhere.  The obvious solution for me was to create an error page that redirect back to the landing page.  This worked fine, and all requests that ended up in a 404 error just landed on the home page.

The problem didn't occur until I tried to add the Google sitemap to Googles database.  I was unable to verify the site because the 404 error was returning the 200 - OK status.  What was my solution?  On the redirect from the error page, which is just a simple header('location: index.php') call, I appended a querystring called error.  Now when the index page gets an error=404 querystring, it appends:
header("HTTP/1.0 404 Not Found");
to the HTTPheader.

I have been learning there are a lot of little subtleties to HTTP headers that you would never really concern yourself with unless you were a web standards nut, like I'm becoming.