Recently, I faced an issue with one of my website – Infopixi. Google Webmaster was unable to verify this domain because the home page was returning ‘404 (Not Found)’ instead of ‘200 (OK)’. The page definitely was there and opening correctly in all platforms, when I checked with Responsinator.
I also cross-checked this with HTTP/HTTPs header checking tools, the homepage was really giving the 404, other pages (internal pages, blogs, category pages etc.) were returning 200.
I searched online for the solution and raised the question on WordPress Forum, but got no substantial solution. I checked the .htaccess file, permalink settings, file permissions and made the changes accordingly but nothing happened.
(Make sure to backup your .htaccess file before making any changes to it.)
What the heck was the problem? I was confused and didn’t know what to do.
How I fixed the problem?
Take a look at the response code returned by the Home Page.
Look at this line:
Cache-Control => no-cache, must-revalidate, max-age=0
Cache-Control specifies the directives (the manners in which a page is to be cached) that must be obeyed by all caching mechanisms. The “no-cache” directive is specifying that the cache needs successful revalidation from the origin server.
The “max-age” response directive indicates that the response is to be considered stale after its age is greater than the specified number of seconds, in this case, it is zero seconds.
Simply put, Caching is a feature that optimizes your website and improves performance. Sometimes, it might create problems and need to be cleared.
So, I installed a plugin named WP Total Cache to enable caching and empty all the existing cache for the changes to take effects.
Then, I checked the home page header response code. And It worked!! Now the homepage is returning 200 (OK) status code instead of a 404. Google has also verified the ownership in Search Console.
Do you think there is another way of fixing this problem? What is that? I would love to know in comments.