I have an apache HTTP server with a directory structure as such:
/
---- api/
---- ---- index.php
---- ---- .htaccess
---- index.php
---- .htaccess
/.htaccess:
DirectorySlash Off
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*[^/])$ $1/
/api/.htaccess
RewriteEngine On
My objective was to display the index.php of a directory when it was called without a trailing backslash. However, calling http://domain.com/api results in a 404. Commmenting out the one line in /api/.htaccess causes everything to work as expected.
I'm having a hard time understanding this behavior as the doc for RewriteEngine On says nothing about it. Could someone shed some light on mod_rewrite's workings here?
Note: This question was originally posted on SO here but received no response. I will close it if this one solves the issue.
EDIT: As per @Jonah B's suggestion that a new rewrite context might be created, I tried changing the rules of /api/.htaccess to the following:
RewriteEngine On
RewriteRule ^ index.php
but the result remains the same - it still 404s.