What should happen when a page doesn’t exist on your site? If I have a custom error page set up in my .htaccess, I get a 302 temporary redirect to my 404 page (where I send 404 headers). Is this how it should work? Or should I do a 301 permanent redirect to the error page? I’m using php and Apache.
Share
The non-existent page has not “temporarily moved” (301) or “permanently moved” (302) to a page about the file not existing, it doesn’t exist. The correct header to send is a 404, not anything else.
Don’t redirect anywhere, instead serve your “file not found” page content at the URL that was requested.