.htaccess - htaccess 内部服务器错误

标签 .htaccess mod-rewrite internal-server-error

当我转到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/

相关文章:

.htaccess - 重写规则以添加 .html 扩展名

apache - .htaccess - 通用规则

azure - azure 项目的内部服务器错误

php - 由于 index.php 导致 Codeigniter 500 内部服务器错误

php - 通过 MySQL_Connect 访问 MySQL 数据库时发生内部服务器错误

apache - 开始实现 .htaccess,但从简化的 URL 导航时,进入目录时无法返回

.htaccess - 干净的 URL - 将 301 从带有问号的 URL 重定向到新 URL

css - 重写CSS中字体的规则

.htaccess - url重写mod_rewrite

Php 处理与 Apache RewriteRules 和 RegExp : which one is quicker?