我的htaccess中有这个代码重定向到维护页面,但我不能在不显示文件夹名称和文件名(/mce/mce.php)的情况下进行重定向,只显示域名网址domain.com/website:
RewriteEngine On
RewriteBase /website/
RewriteCond %{REMOTE_ADDR} !^1\.2\.3\.4
RewriteCond %{REQUEST_URI} !/website/mce/mce.php$ [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
RewriteRule .* /website/mce/mce.php [R=302,L]
答案 0 :(得分:0)
您可以使用此规则:
RewriteEngine On
RewriteBase /website/
RewriteRule \.(jpe?g?|png|gif|ics|css|js)$ - [L,NC]
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{REMOTE_ADDR} !=1.2.3.4
RewriteRule . /website/ [L,R=302]
RewriteCond %{REMOTE_ADDR} !=1.2.3.4
RewriteRule ^ mce/mce.php [L]