As you know in the documentation, when DirectorySlash set to Off , /folder requests do not have DirectoryIndex . This means that the request will not automatically display on /folder/index.php .
mod_dir performs this check in the “fix” phase of request processing. mod_rewrite , which is responsible for your RewriteRule definitions, also does its processing at this point when you specify the rules in the .htaccess file.
However, it was programmed for modules of type mod_dir and includes a check to ensure that the current directory is requested with a trailing slash. If not, it refuses to process the request, as this may lead to undefined behavior.
Then the request proceeds to the content creation phase, which, since the request was not attached to a real file, is processed by mod_autoindex . Given that Indexes disabled on your host by default, mod_autoindex returns 403 Forbidden , what you see.
Note that since DirectoryIndex not evaluated, even if mod_rewrite should have handled the request, it will still fail because there will not be automatic permission for index.php , and your rule
RewriteRule . /folder/index.php [L]
will not match because . requires a match for something (but the request will be empty).
Enabling DirectorySlash prevents this scenario by correcting the prevented actions in all of the above scenarios, with the exception of the last note, which takes care of the fact that DirectoryIndex still displays a request for index.php .
Tim stone
source share