custom 404 that returns 404 instead of 200

jrmarino

Well-Known Member
#1
I just realized that my Google webmaster tools no longer works. This is because I enabled the custom 404 pages. Here is the explanation google provided:

We've detected that your server returns a status of 200 (found successfully) for pages that don't exist.

We've detected that your server returns a status of 200 (found successfully) for pages that don't exist. We can't verify sites with this configuration because it would enable anyone to verify ownership of your site. You can try our meta tag verification method or change your server's configuration.

This configuration presents a security risk for site verification and therefore, we can't verify your site. If your web server is configured to return a status of 200 (found) in the header of 404 (not found) pages, and we enabled you to verify your site with this configuration, others would be able to take advantage of this and verify your site as well. To ensure that no one can take advantage of this configuration to view statistics to sites they don't own, we only verify sites that return a status of 404 in the header of 404 pages.

If your server is configured to return something other than a 404 for non-existent pages, try our meta tag verification method or change your server's configuration.

You can change your web server configuration to return a status of 404 in the header of 404 pages and still provide a custom error page (see Apache information and IIS information). Note that we do a HEAD request (and not a GET request) when we check for this. Once your web server is configured correctly, try to verify the site again and we'll recheck your configuration.
Can I do this in Litespeed? I want to return a 404 status for the custom 404 pages that catch bad URLs so I can recover my Google webmaster tools functionality.
 

mistwang

LiteSpeed Staff
#2
Are you using a script for the custom 404 page? Internally, LiteSpeed does return 404 for static custom error page.

Our Rails support uses 404 handler, the status code returned by the script will be used. So, if you use a script for 404 page, you should explicitly set the status code to 404 in the script.
 

jrmarino

Well-Known Member
#3
I'm not sure I understand the question.

Under virtual host --> general I defined a custom error page for the error "404 not found". After that, All I did was set the URL, which happens to be $VH_root/404.php

do you consider the "404.php" file a script? Seems like it could be static HTML will the same result.
 

mistwang

LiteSpeed Staff
#4
404.php is a PHP script. Using static HTML will return 404.
If you want to use 404.php, you need to set status code to 404 explicitly in that script.
 
Top