Google sitemap verification error (404 versus 200)

Question:

I have submitted my sitemap to google. During the verifiction process, google reports an error from their verification saying that the server is reporting a status 200 instead of an error 404.

Could you assist with this?

Answer:

This occurs when you are running php as a cgi and a non-existant php page is called. When php runs as a cgi the webserver never checks for valid files – it just sends it straight to the php parser. The php parse does not return a 404, instead it errors with “No input file specified”

Add the following to your .htaccess (or create a .htaccess file if you don’t already have one) and it should fix it

RewriteEngine On
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} !-f
RewriteRule ^.+.php$ /file_that_does_not_exist

The code above will cause the server to check for valid files first and redirect to a file that does not exist and trigger the 404.

Leave a Reply

Your email address will not be published. Required fields are marked *