I’m getting a lot of “Soft 404″ errors through our google search console and I was wondering it you knew whether the HTTP status of the 404.php page is 200, 404 or 410. If it’s a 200, I’d like to customize this to be an actual 404 page. I was thinking that I could create a custom header that still has the navigation and look and feel of the current 404 by creating a 404 version of the current header file that only changes the HTTP status. Which header file would I edit – the header.php pr head.php files?
The default status of the 404.php page is set by WordPress as 404. The theme does not change the status code.
If you’d like to manually change a header response, you probably don’t want to do it inside the template as a response has already been sent. Instead, WordPress offers a status_header() hook you can add a filter too.
However, if you’re getting this response on your actual 404 pages (and not trying to manually set this up for a different page like a search query with no results or custom page), then your issue may lay in your server configuration. For example, if your problem is in your htaccess file, you may not be able to modify any response given by WordPress.