I need to carry out maintenance on the site and be the only one who can access it. I wrote the following rewrite rule:
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^46\.233\.116\.53
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^(.*)$ http://maydomain.com/maintenance.html [R=307,L]
I should redirect any IP to the maintenance page except mine (46.233.116.53) but unfortunately is redirecting mine too. I also tried to wrap the rule within
<IfModule mod_rewrite.c>
.....
</IfModule>
But still no luck. Is there anything my hosting should do as they seem to have no suggestion :(
This is what I currently use.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^00\.000\.00\.00 #Replace with real ip
RewriteCond %{REQUEST_URI} !/maintenance.htmlp$ [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif|css) [NC]
RewriteRule .* /maintenance.html [R=302,L]
</IfModule>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.