My shared hosting service returns an apache 403 error when the user navigates to a folder containing no index.php
My localhost returns an apache 404 error when the user navigates to the same folder containing no index.php
My localhost apache server currently has the following module disabled:
#LoadModule autoindex_module modules/mod_autoindex.so
Now I don't believe this is a problem because the server really didn't find a file thus, it should indeed return a 404.
I am curious as to how my shared hosting apache server chooses to return a 403 error.
The 403 is triggered by mod_autoindex when formatted directory listings are disabled (the default) and no other response has already been served (eg. by mod_dir serving the
DirectoryIndex
/ index document). The 403 is perhaps seen as the more appropriate response in this instance (rather than a 404), since the module is loaded/enabled but the option to actually display the directory listing is explicitly disabled.If mod_autoindex is not loaded then the request falls through to a 404.
What you are seeing is expected/default Apache behaviour. mod_autoindex is loaded by default.