我正在尝试使用.htaccess创建干净的URL,但是当我将它们放在一起时却无法正常工作。我在做什么错
我想从
localhost/new/index.php?page=dashboard
至localhost/new/dashboard
,但我得到Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
另一方面,如果我删除RewriteRule ^(.*)$ $1.php [NC,L]
可以很好地解决这个问题,但是localhost/new/auth/login
在不添加.php扩展名的情况下将无法工作(localhost/new/auth.php/login
可以)。因此,我需要做出折衷……但我不想这么做。我认为索引的规则是错误的,我不知道该怎么做。
.htaccess文件
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)$ $1.php [NC,L]
RewriteRule ^auth/([^/]+)/?$ auth.php?page=$1 [L,QSA]
RewriteRule ^([a-zA-Z0-9]+)$ index.php?page=$1
目标是拥有
localhost/new/dashboard' and 'localhost/new/auth/login' working together. Now with this
。htaccess file I get
内部服务器错误
服务器遇到内部错误或配置错误,无法完成您的请求。
我应该如何解决?