1

我正在使用这个在生产服务器中工作但在 xampp 中不工作的 htaccess 代码,我可以知道为什么

RewriteEngine On
RewriteRule ^\.htaccess$ – [F]
RewriteCond %{REQUEST_URI} =”"
RewriteRule ^.*$ /public/index.php [NC,L]
RewriteCond %{REQUEST_URI} !^/public/.*$
RewriteRule ^(.*)$ /public/$1
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ – [NC,L]
RewriteRule ^public/.*$ /public/index.php [NC,L]
4

2 回答 2

-1

即使将非 ascii 双引号更改为 ascii 双引号,该条件也应该始终失败="",因为 apache 将尝试将 URI(始终以斜杠开头)与字符 匹配=。尝试更改以下 2 行:

RewriteCond %{REQUEST_URI} =”"
RewriteRule ^.*$ /public/index.php [NC,L]

至:

RewriteRule ^$ /public/index.php [L]
于 2012-08-14T17:47:02.620 回答
-1

在第三行你有一个非法字符:

RewriteCond %{REQUEST_URI} =”"

应该

RewriteCond %{REQUEST_URI} =""
于 2012-08-14T15:49:36.033 回答