Remove .php extensions with .htaccess without breaking DirectoryIndex
问题 I have the following rewrite in my .htaccess file which removes the .php extension from files, converting for example so.com/question.php to so.com/question . RewriteEngine On RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^([^\.]+)$ $1.php [NC,L] However this also breaks the default DirectoryIndex behaviour, in which just typing the directory will redirect to the index file in the folder, e.g. so.com/answer displays so.com/answer/index.php Simply combining the above code with DirectoryIndex