I'm thinking you just need to verify that the file exists prior to doing the rewrite, that way you'll leave 404 and directoryindex behaviours intact:RewriteEngine OnRewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME}.php -fRewriteRule ^(.*)$ $1.php [NC,L](未测试) 这篇关于使用 .htaccess 删除 .php 扩展名而不破坏 DirectoryIndex的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-13 09:11