Forum Moderators: coopster
For example:
User accesses
http://www.example.com/parts/pn12345.html
which translates to
http://www.example.com/parts/lookup.php?ID=12345
where part number 12345 is not in the database.
I would think 404 would be the proper response, but I need to redirect to another page. I have a parts index that I want the user taken to without having to click on anything.
Thanks
Barry
After all, they could be following a link from search engine for a product that you no longer sell. I wouldn't want people getting a Page Does Not Exist error in that case.
You could also add a javascript or meta refresh to take them to your parts index page.
if(!isset($result) OR empty($result)) { header($_SERVER['SERVER_PROTOCOL']." 404 Not Found"); exit(); }
You could use a timed refresh to another page, or you could turn this into a custom error page, by serving information after the 'Not Found' header rather than exiting.
There have been some large issues with sites not serving 404s when they should -- I am not the only one, but here is an example: one of my sites got 'stuck' in the indexing process (Google:~400 out of 18K pages and Y ~1800 out of 18K pages -- they were at these numbers for months) within 2 weeks of serving 404s G had the entire site, and Y started adding 200 pages every couple of days. I guess they like it when webmasters communicate with them properly.
One of the other issues noted, is people are having their 404 page (custom) indexed, because they are not serving a 404 (most of the time end users receive a 302 instead)... they have reported having hundreds of non-existent URLs indexed and credited to their site. Since the SEs did not get a 404 message, they 'thought' the custom error page was really duplicated at every non-existent URL they requested -- needless to say those site owners have some duplicate content issues now.
Justin