Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We have a service configured that must go down once a week for maintenance as it is dependent on the ERP system which goes down. I'm wondering if it's possible for Apache to stop forwarding requests to Tomcat and instead serve up static content?

I imagine I could achieve this by setting up a cron job to a2enable-site and a2disable-site respectively by having a static site that gets switched out for the proxy site though I was wondering if there was a different approach I could use.


share|improve this question
up vote 2 down vote accepted

mod_rewrite can do rules based on the current time. Something like this untested snippet might just work:

RewriteCond %{TIME_WDAY} 1
RewriteCond %{TIME_HOUR} 5
RewriteRule .* /sorry.html [L,R]
share|improve this answer
Dennis, this looks like exactly what I'm after. I'll have to do some experimenting, though the mod_rewrite documentation seems to suggest this is something I can do. Since every request would go through the rewrite rule, would this have any noticeable affect on performance? – Brett Ryan Nov 18 '12 at 14:32
That depends on your rule. Something as simple as the above shouldn't be noticeable. – Dennis Kaarsemaker Nov 18 '12 at 14:34

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.