Forum Moderators: phranque

Message Too Old, No Replies

problem indexing

         

helenp

9:18 pm on Aug 3, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Hi, I have a site which have a page index with categories,
so for example mysite.com/index.php exists, also exists mysite.com/index.php?cat=10 and more categories like that.
The problems is that googles indexes the categories as well, I donīt know if that is good.
The worst is that google has indexed categories numbers that no longer exists.
If I search for my domain I get several pages like this mysite.com/index.php?cat=22, as that category does not exist anymore, I get an index page with error if I click on it, I donīt get any 404 error.
What should I do about this?

coopster

1:48 pm on Aug 4, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



If the category does not exist you can monitor for that in your processing script and send out a
404 Not Found
with your appropriate page. If the page did exist at one point in time but is no longer available you may want to send a
410 Gone
instead.

helenp

2:18 pm on Aug 4, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks, But I donīt understand how to do it.
The page exists, as if I click on the link in google it gives me the indexpage with a category that no longer exists, i.e a page with a mysql error.

And I think this will be a problem always as categories and other pager may disapear.

Searching I found this thread:
[webmasterworld.com...]
and it sounds interesting to do something similar

phranque

6:19 am on Aug 5, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



you need to insure that the initial HTTP response is a 404 (or 410 if appropriate) and not a 200 OK with an error message or a 301 or 302 redirect to an error page.

coopster

5:59 pm on Aug 5, 2008 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



OK, so the page exists, but the category does not. Therefore what you are saying is that the URI, the requested resource, was not found. So now you can send out the appropriate headers by monitoring for that in your server-side processing script. Something like this, using PHP:
if (!$category) { 
header('HTTP/1.x 404 Not Found');
include realpath($_SERVER['DOCUMENT_ROOT'] . '/error_docs/not_found.html');
exit;
}

Be certain you have not printed any other information to the browser first.