TheMadScientist - 1:05 am on Nov 2, 2012 (gmt 0)
If you don't already have a 503 solution...
### # ###
In the .htaccess file:
RewriteRule .? /serve-503-error.php [L]
In a faster / better place, the httpd.conf file:
RewriteRule . /serve-503-error.php [L]
### # ###
The error header must go at the top of /serve-503-error.php, meaning before any other output (even a space) is sent to the requesting user-agent ... You can run some code before sending the error, but cannot send any output until after the error is served, so the header() lines should go as close to the top of the page as possible.
header('HTTP/1.1 503 Service Unavailable');
### Some more php code to run down here, such as tracking URLs requested and things along those lines.
### Replace DAYS above with the number of days to Retry-After. I would personally go with 7 to 14 in this case, depending on how fast you think you can put things back together a bit. You can always shorten it up later if you get moving along faster.
### There's other ways to code the number to retry-after, but the above is simple to edit.
### The reason I suggest doing it with the internal redirect is you have a bunch of control over things and a ton of flexibility once you get everything running through a separate 503 page, such as, when you add back a few URLs you'll be able to easily check and see if the URL exists and if it does serve the info without the 503 error, otherwise continue serving the 503 error for that URL.
<!-- A Really Cool HTML Page Here for Visitors to See -->
NOTE: Edited a few times ... Coding off the top of my head without really knowing the entire setup for the site in the future or all the details of the situation I'd want to actually code a solution ... The above should work and be solid, but is it the absolute best in this specific situation? Can't say for sure, but it should be close IMO.