start | find | index | login or register | edit | ||
2009-07-20
by earl, 5603 days ago
A simple mod_rewrite-based "maintenance mode"You might have noticed the "down for maintenance" notice earlier today. This was enabled using a simple touch MAINTENANCE in the appropriate directory. Witness the magic of mod_rewrite! You want this as well? Here's the rules used:
With that in place, if a file named MAINTENANCE exists in the document root of your site, all requests will be internally proxied to maintenance.asis . Here's an example for such a maintenance.asis :
Obviously, you could also use any other target as well, like a PHP script, for example. Once that's in place, enabling maintenance mode is a simple as creating said MAINTENANCE file in your document root. To disable maintenance mode, just remove this file again.As a simple but effective extension, you can allow access on an IP-level during maintenance mode by adding the following rewrite condition:
Well, all hail the mighty mod_rewrite! And if you need a stupid "maintenance-only" webserver, have a look at 2006-05-07. |
search 41 active users
backlinks (more) none, yet recent stores (more) recent comments echo earlZstrainYat|tr ZY @. |
|
earl.strain.at • esa3 • online for 8662 days • c'est un vanilla site |