Go back
Offline for maintenance ...

Offline for maintenance ...

Help

d

Brooklyn, NY

Joined
19 May 04
Moves
14088
Clock
24 Aug 04
Vote Up
Vote Down

I tend to always end up playing around midnight EST, so hit the offline for maintenance an awful lot.

It bothers me that it's structured such that reload doesn't work, so thought I'd offer the apache configuration I use for my offline pages when I need them. In short, when it's activated, any request just gets locally mapped to the offline page, with an extra tweak to allow the offline accessories (images, stylesheets, whatever) to load just fine.

Here it is:

<IfDefine OFFLINE>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/offline/
RewriteRule .* /offline/index.html [L]
</IfDefine>


To translate:
0) if apache is started with -DOFFLINE declaration, then ....
1) turn the mod_rewrite engine on
2) anything with a URI that begins /offline/ gets let through
3) anything else gets rewritten to the offline/index.html page

Russ
RHP Code Monkey

RHP HQ

Joined
21 Feb 01
Moves
2450
Clock
24 Aug 04
Vote Up
Vote Down

This is a good idea, thanks, but not appropriate for our situation.

We do live testing when the site is down - I can use the site as normal. So we can't do this at the Apache level.

I have always planned to modify that maintenance page so it appears on the last page you used, and therefore, even if you made a large forum post and the site went down, you could just wait and press ‘refresh’ on the browser until the site came up, and the your efforts would still be saved.

This is a very trivial change, so I will try to do it on the next update.

-Russ

d

Brooklyn, NY

Joined
19 May 04
Moves
14088
Clock
24 Aug 04
Vote Up
Vote Down

This is still workable, if you add additional exclusions for your IP (if it's static?), or some magic cookie content, or ...

<IfDefine OFFLINE>
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/offline/
RewriteCond %{REMOTE_ADDR} !^123\.123\.123\.123
RewriteCond %{REMOTE_ADDR} !^234\.234\.234\.234

RewriteRule .* /offline/index.html [L]
</IfDefine>

Cookies help us deliver our Services. By using our Services or clicking I agree, you agree to our use of cookies. Learn More.