I am trying to set up a maintenance mode using .htaccess
, which allows a user visiting from a certain IP to still view the site. The site is running from a CMS (Perch Runway) which uses rewrite rules as part of the system, so these would need to be working for the visitor from that IP. The Perch Runway code is this:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/perch
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* /admin/core/runway/start.php [L]
My redirect maintenance code is this:
RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_ADDR} !^11\.111\.111\.111
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^(.*)$ http://domain.com/maintenance.html [R=307,L]
I have tried combining the two but am getting a redirect loop. So in short I need to have:
- Maintenance mode redirect to maintenance.html
- Person visiting from IP 11.111.111.111 does not get affected by this redirect
- Person visiting from IP 11.111.111.111 still gets affected by Perch Runway redirects
Please note I want to show the maintenance.html
page to those not visiting from the specified IP, so can't use deny
.
Help greatly appreciated!