Paul Tarjan Paul Tarjan - 1 year ago 116
Apache Configuration Question

Rewrite rule for "site down" pages

I was trying to install this .htaccess to notify my users of site maintenance. It seems the first [L] isn't working and the second rewrite is doing everything.

How do you guys do site maintenance messages?

RewriteEngine on

RewriteRule ^s/down$ index.html [L]
RewriteRule ^(.*)$ [R=302,L]

Answer Source

This seems to work (but I have to set the status code in PHP)

RewriteEngine on

RewriteCond %{REQUEST_URI} !^/static/.*$
RewriteCond %{REQUEST_URI} !^/media/.*$
RewriteRule .* down.php [L]

and in down.php

header('HTTP/1.1 503 Service Temporarily Unavailable',true,503);

Any problems with this? My main concerns are what user's see (which is why i keep static content) and what search engines see (the 503 status code).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download