这是我的.htaccess
RewriteEngine On
RewriteCond $1 !^(index\.php|public)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(acp|acp/)$ /acp/home.html [L,R=301]
RewriteRule ^(.*).html$ index.php/$1 [QSA,L]
但是当我将html文件上传到根文件夹(例如:ads.html)并运行http://domain.com/ads.html时,它无法正常工作,如何修复
答案 0 :(得分:0)
条件仅适用于之前出现的规则。您的条件适用于将acp
重写为acp/home.html
的规则。您希望在第二个规则之前直接移动条件。你最终会得到:
RewriteEngine On
RewriteRule ^(acp|acp/)$ /acp/home.html [L,R=301]
RewriteCond $1 !^(index\.php|public)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*).html$ index.php/$1 [QSA,L]