We have a custom 404 page setup and the appropriate ErrorDocument 404 code in the .htaccess file.
From a user point of view this works fine. When an incorrect page is entered, it displays the 404 page.
However, from a server point of view, the 404 header is not being returned. If I use http://web-sniffer.net/ to view the headers, it shows that an incorrect page (eg. www.domain.com/blablabla )
is actually returning a 302 found header - with the 302 redirect pointing to the 404 page, which itself returns a 200 OK status.
I'm a little concerned as this is leading to soft 404 errors in Google Search Console, with the following message displayed:
Is there some code I'm missing, either in the layouts or in the .htaccess that would return the proper 404 status header? Or does something need to be altered server-side?
From a user point of view this works fine. When an incorrect page is entered, it displays the 404 page.
However, from a server point of view, the 404 header is not being returned. If I use http://web-sniffer.net/ to view the headers, it shows that an incorrect page (eg. www.domain.com/blablabla )
is actually returning a 302 found header - with the 302 redirect pointing to the 404 page, which itself returns a 200 OK status.
I'm a little concerned as this is leading to soft 404 errors in Google Search Console, with the following message displayed:
The target URL doesn't exist, but your server is not returning a 404 (file not found) error.
Your server is redirecting requests for a non-existent page, instead of returning a 404 response code. This creates a poor experience for searchers and search engines.
Your server is redirecting requests for a non-existent page, instead of returning a 404 response code. This creates a poor experience for searchers and search engines.