I'm trying to figure out the correct way to send visitors to a custom 404 page when they hit a page that doesn't exist.

Is issuing a 301 redirect to the custom 404 page the recommended method?

  • Given that I edited the question, any chance of undoing that downvote?
    – Drewdavid
    Sep 11 '14 at 19:46

You do not want to do a 301 redirect to a 404 page. The 404 HTTP response tells the user-agent (browser, search engine, etc) that the requested document cannot be found. If you send a 301 HTTP response then they will think the document has moved to the new location which is your 404 page. That is not accurate.

When you encounter a page not found send the HTTP 404 response but load your custom 404 error page. That way the result of the request is accurate (and hopefully your error page explains it well in layman's terms so users can hopefully react to it in a way that is helpful to them and you).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.