404 error confusion

by 2 replies
3
I'm confused about 404 error messages and webmaster tools advice?

I have an a .htaccess file which states:

ErrorDocument 404 http://www.XXXXXXX.com/index.html

and these soft 404 redirects have been working fine.

In webmaster tools I have just received the error:

"Increase in soft 404 errors - Google detected a significant increase in URLs we think should return a 404 (Page Not Found) error "

So google wants me to return a 404 on my deleted pages but for my visitors I want a redirect to the home page (in-case of mis-typing).

Later google advice a little vague:
"But it's important to remember that it's not enough to just create a page that displays a 404 message. You also need to return the correct 404 or 410 HTTP response code." https://support.google.com/webmaster.../2409443?hl=en

I don't want to use 301 because there are too many low value pages.

So how do you return a 404 code to google's robot but direct visitors to a custom 404 error page? I cann't seem to find an answer anywhere.
Thanks
#programming #.htaccess #404 #confusion #error #page not found
  • You don't want to do anything different for Google unless you like playing in a sandbox.

    Use the 301 and don't worry if it was low value. The 301 is the best way to get it out of G's index
  • I'm using URL rewriting in this case to display a custom error page while returning 404 in the HTTP response. That custom page would typically contain a human readable sitemap.

    How this is achieved technically depends on your hosting environment, the article below explains how URL rewriting is added in PHP:
    URL rewriting with PHP - Stack Overflow

Next Topics on Trending Feed