如果不给500,我将无法正常访问htaccess

时间:2019-08-24 18:11:11

标签: php .htaccess routing

我正在尝试使用.htaccess创建干净的URL,但是当我将它们放在一起时却无法正常工作。我在做什么错

我想从 localhost/new/index.php?page=dashboardlocalhost/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内部服务器错误 服务器遇到内部错误或配置错误,无法完成您的请求。

我应该如何解决?

0 个答案:

没有答案