II6 ISAPI - 404 Response Code

ISAPI_Rewrite is a powerful URL manipulation engine based on regular expressions
User avatar
Posts: 6
Joined: 09 Aug 2014, 07:40

II6 ISAPI - 404 Response Code

20 Aug 2014, 20:40

Hi,
I can't find an answer to this and so hope someone can help please:

Google is reporting "Soft 404" Errors whenever it crawls a PHP database URL that has been deleted from the web site- as the server isn't correctly responding with a 404 response code. All that happens is that the PHP web page code (on seeing there is nothing in the database ) generates a custom error page "error.html" which shows a HTTP 1.1 200 OK server response.

I guess I could do loads of permanent redirections to the home page but understand this is not SEO friendly so that seems out.

Is there anyway in PHP or IIS6 rewrite2 that I can get the server to respond correctly ?
(All the URLs in the database follow a similar format "/product.php?id=87 )
Thanks
Neil

User avatar
Posts: 871
Joined: 12 Mar 2012, 09:54

Re: II6 ISAPI - 404 Response Code

21 Aug 2014, 03:46

Hello, Neil

Do you mean you want to get 404 status code whenever a non-existent product is requested?
I guess it's bot quite possible with ISAPI_Rewrite2 and you have to look into PHP settings.
Have a look at this post for ideas: http://wordpress.stackexchange.com/ques ... ted-to-404

User avatar
Posts: 6
Joined: 09 Aug 2014, 07:40

Re: II6 ISAPI - 404 Response Code

21 Aug 2014, 06:59

Hello Anton,

Thanks again :D

Within the PHP file that writes both the product ads (and the actual error page) I replaced :

if ($item_exists == 0) {
?>
<p> sorry the product can't be found etc ..........</p>

WITH

if ($item_exists == 0) {
header("HTTP/1.0 404 Not Found", TRUE);
?>
<p> sorry the product can't be found etc ..........</p>

Have tested it and a 404 code is returned on products that don't exist and a 200 on the products that do exist. Google can't crawl the non existent products so all is fixed. :)

Many Thanks.

Neil

Return to ISAPI_Rewrite 2.x

Who is online

Users browsing this forum: No registered users and 0 guests