Forum Moderators: phranque
missing.html - nothing else on the page so I put it back the way it was.You do not say either how you tested it or what you have in your page that did not show. If you entered a fictional URL in your browser and it served your "missing.html" page and there was nothing on the page it is because you have not actually created a custom html page named missing.html. The server will serve the "missing.html" page for a 404 error, but the server does not create the page or add anything to whatever you have created.
I set up the htaccess file like this:
ErrorDocument 404 https://example.com/missing.html
I also see 302's in access logs involving the missing page like this:
Note that when you specify an ErrorDocument that points to a remote URL (ie. anything with a method such as http in front of it), Apache HTTP Server will send a redirect to the client to tell it where to find the document, even if the document ends up being on the same server. This has several implications, the most important being that the client will not receive the original error status code, but instead will receive a redirect status code. This in turn can confuse web robots and other clients which try to determine if a URL is valid using the status code.(from Apache Core Features documentation)
I left off the url like this:
ErrorDocument 404 missing.html
and tested it and a page came up with:
missing.html - nothing else on the page so I put it back the way it was.
output a simple hardcoded error message(from Apache Core Features documentation)
ErrorDocument 404 /missing.html URLs can begin with a slash (/) for local web-paths (relative to the DocumentRoot), or be a full URL which the client can resolve.(from Apache Core Features documentation)
Do I need to set up a separate htaccess for the custom missing page in each folder for it to work properly?
BTW, I have noticed that anytime there is a site with documents inside folders that the missing file doesn't work unless the full url is used.
Do I need to set up a separate htaccess for the custom missing page in each folder for it to work properly?
There may be settings in .htaccess that can prevent inheriting directives, especially where an additional .htaccess file is used in the folders below root.