How to disable DirectoryIndexRedirect
It looks like what may be happening is mod_dir is attempting to redirect to the same directory but with a trailing slash. There is a really good reason why it does this by default:
Security Warning
Turning off the trailing slash redirect may result in an information disclosure. Consider a situation where
mod_autoindex
is active (Options +Indexes
) andDirectoryIndex
is set to a valid resource (say,index.html
) and there's no other special handler defined for that URL. In this case a request with a trailing slash would show theindex.html
file. But a request without trailing slash would list the directory contents.
Eventhough you have the indexes option turned off, the DirectorySlash
directive is still doing the redirecting. So you can try turning it off but adding a rule at the very end of your list of rules that does the same thing:
So add this somewhere near the top:
DirectorySlash Off
then this at the end of your rules (or something similar, you may need to tweak depending on your folder structure):
RewriteCond %{REQUEST_FILENAME} -dRewriteRule ^(.+[^/])$ /$1/ [L,R]
Just make sure you keep in mind that directory slash is turned off.