If you use WordPress with a Google SiteMap Plugin and you tried to verify the ownership of your blog with Google, you’ve probably seen the error, “We’ve detected that your 404 (file not found) error page returns a status of 200 (OK) in the header.”
Google explains:
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 in the header of 404 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. This would allow others to see your site statistics. 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. Please modify your web server configuration to return a status of 404 in the header of 404 pages. 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. If your web server is configured this way and you receive this error, click Check Status again and we’ll recheck your configuration.
So how do you fix it? My friend Carl Hoerth figured it out and it’s actually very easy:
- You find the header.php file in your chosen WordPress theme
- You rename the file header.old
- You open header.old in a text editor
- Insert a blank line one line above the line that reads something like:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional… - Insert:
<?php if (!have_posts()) { header('HTTP/1.0 404 Not Found'); } ?> - Save this edited file as your new header.php
- Go to http://www.urltrends.com/httpheaderviewer.php and enter http://yourblog.com/page_not_there/ and confirm that your header comes back as HTTP/1.1 404 Not Found.
- Now you can go back to Google SiteMaps and verify your site.







[…] Google SiteMaps: The Google Sitemaps program is two-way communication between webmasters and Google. You can give us information about your site so we can index it more effectively, and we can show you how we see your site and tell you about any trouble we’ve had crawling it. The plugin was developed by Arne Brachhol and has made it to a 3rd revision. The SiteMaps plugin works with both WordPress v1.5-2.x. If you have a problem with Google SiteMaps throwing an error when you try to verify your web address apply the following fix to your template located at christian swanson blogs. […]
[…] If you are having problems getting Googles Sitemaps to verify your site Try modifing your theme as described by Christian Swanson: […]