This is caused by mod_dir and the DirectorySlash directive. It will automatically 301 redirect requests for a directory that's missing the trailing slash. This fixes an information disclosure security concern (described in the above link) which lists the directory contents even when there's an index file (e.g. index.php
). So if you turn this functionality off, be very careful about your directories. If you've got directory indexing turned off, then that's not so much of a concern.
You can turn of directory slashes using:
DirectorySlash Off
You can turn off directory indexing using the Options:
Options -Indexes
And then, you need to have your projects rule before your php extension rule:
Options +FollowSymLinks -MultiViews -Indexes
DirectorySlash Off
RewriteEngine on
RewriteRule ^projects$ /projects/index.php [L,E=LOOP:1]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.php [NC,L]