我想把我的网页放到维护中,所以我用这个替换原来的htaccess文件:
ErrorDocument 403 /maintenance/maintenance.php
order deny,allow
deny from all
allow from 111.222.333.444
Run Code Online (Sandbox Code Playgroud)
在发布之前已经阅读了很多线程,这是我收集的将是正确的解决方案,但我不能让它工作.如果我不允许使用我自己的IP,我会收到错误500(这意味着我的访问者会看到),如果我使用我的IP,我会得到错误403(我甚至没有到达我的维护页面,这就是我也不允许在那里).
我在这做错了什么?提前致谢.
找到适合我的解决方案.
RewriteEngine On
RewriteBase /
#ip is not your ip. Change ip to see maintenance page
RewriteCond %{REMOTE_ADDR} !^111\.222\.333\.444$
#requests made not to maintenance.php ...
RewriteCond %{REQUEST_URI} !^/maintenance\.php$
#rewrite to maintenance.php
RewriteRule ^(.*)$ /maintenance.php [L]
Run Code Online (Sandbox Code Playgroud)