Would like to prepare a maintenance page for a tomcat webserver via tuckey rewriting rules.
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !AAA.BBB.CCC.DDD
RewriteCond %{DOCUMENT_ROOT}/maintenance.html -f
RewriteCond %{DOCUMENT_ROOT}/maintenance.enable -f
RewriteCond %{SCRIPT_FILENAME} !maintenance.html
RewriteRule ^.*$ /maintenance.html [R=503,L]
ErrorDocument 503 /maintenance.html
What this does is...
turn on the rewrite engine
don't match your workstation or office IP address. (An exclusion so you can see the actual site, optional)
make sure the maintenance page exists
check for the .enable file. This is how you turn the holding page on and off. So that a service restart is not needed
don't apply the rule when serving the maintenance page (avoids circular rewrites)
Then the rule itself...