Thursday, June 05, 2008

apache vhost maintenance switching

problem:
i need to put my site into maintenance mode when some work is being done on the app servers.

solution:
add this rewrite to all vhosts that need to be taken down. When the switch needs to happen, create /system/maintenance.html
delete the file, or rename it when the maintenance is finished.

RewriteCond /system/maintenance.html -f
RewriteRule ^.*$ /system/maintenance.html [L]

NOTE:
this solution will cause all your images/js/css files to redirect to the maintenance page. Modify the regex if that is a problem, otherwise, dont use any image/js/css on the maintenance.html page.

No comments:

Post a Comment