当我转到http://example.com/not-here时我收到内部服务器错误而不是 404,这是我的 htaccess 文件(它删除了扩展名,因此可以通过 example.com/abc 而不是 example.com/abc.php 访问 abc.php):
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /$1.php [L,QSA]
DirectoryIndex login.php index.php
ErrorDocument 403 /error.php?type=403
ErrorDocument 404 /error.php?type=404
ErrorDocument 500 /error.php?type=500
它可能非常简单,但我看不到它,任何帮助都适用
最佳答案
我应该在 .htaccess 中有以下内容:
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} !rewrited
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ /$1.php?rewrited=1 [L,QSA]
DirectoryIndex login.php index.php
ErrorDocument 403 /error.php?type=403
ErrorDocument 404 /error.php?type=404
ErrorDocument 500 /error.php?type=500
关于.htaccess - htaccess 内部服务器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6201174/