Paul Tarjan Paul Tarjan - 2 months ago 18
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 ^(.*)$ http://metaward.com/s/down [R=302,L]

Answer

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

<?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).