So I use the following for to force my site into maintenance mode while updating certain things:
# MAINTENANCE-PAGE REDIRECT
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^23\.1\.12\.167
RewriteCond %{REQUEST_URI} !/maintenance.html$ [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
RewriteRule .* /maintenance.html [R=302,L]
</IfModule>
This has worked well, but now I have the situation when in maintenance mode that I wish to exclude certain dir’s from being sent to the maintenance.html and rather have them display their normal contents.
So it would be something like:
root/
.htaccess
maintenance.html
index.html
everything.else.html
/do_not_display_me
/display_me_always
Not sure if this is possible from the root level .htaccess or if I’m going to have to get crafty with sub-dir .htaccess files, any help is appreciated.
This should do the job. It tells Apache to not to rewrite those folders (which makes maintenance rules to be omitted as rewrite chain will never reach them).
NC,into[OR]./at the end of folder names if you have files in root folder with the same names.