.htaccess 文件 - 删除 .php 扩展名 "Server Error"
.htaccess file - removing .php extension "Server Error"
我刚刚创建了一个 .htaccess
文件,我在 XAMPP 中使用它,它位于 Z:/xampp/htdocs/.htaccess
中,我添加了代码:
RewriteEngine on
RewriteCond % {REQUEST_FILENAME} !-f
RewriteCond % {REQUEST_FILENAME} !-d
RewriteRule ^ (.*).php [L,QSA]
但是当我加载任何页面时出现错误:
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.
我以前见过其他人遇到过这个错误,并尝试过其他人的修复,但对我没有任何帮助,当我不再收到错误时,它不会删除 .php 扩展名。
有人知道问题出在哪里吗?
试试这个
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ .php [NC,L]
以及在 Apache 中 httpd.conf
检查重写
我刚刚创建了一个 .htaccess
文件,我在 XAMPP 中使用它,它位于 Z:/xampp/htdocs/.htaccess
中,我添加了代码:
RewriteEngine on
RewriteCond % {REQUEST_FILENAME} !-f
RewriteCond % {REQUEST_FILENAME} !-d
RewriteRule ^ (.*).php [L,QSA]
但是当我加载任何页面时出现错误:
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script.
我以前见过其他人遇到过这个错误,并尝试过其他人的修复,但对我没有任何帮助,当我不再收到错误时,它不会删除 .php 扩展名。
有人知道问题出在哪里吗?
试试这个
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ .php [NC,L]
以及在 Apache 中 httpd.conf
检查重写