Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Down for maintence page in CMS

Go to End

13 Posts   2762 Views


10 June 2009 at 3:02am Community Member, 509 Posts

I seem to posting a lot in here at the moment...

I was wondering if there is a way to create a "Down for maintenence" page through the CMS that would publish a html page (Just like ErrorPage does now)?

Could I achieve this through a subclass of error page? Or is there a class that I can use to generate a html file from my own page class?

Any help appreciated,



10 June 2009 at 4:41am Community Member, 901 Posts

I would be interested in a solution to this as well.
Usually I just add a rewrite rule in my .htaccess, before the SilverStripe rewrite rule. This then redirects to the "down for maintenance" page.
So it actually reduces to un/commenting a line in the .htaccess.

Changing it inside the CMS would be much nicer though.


10 June 2009 at 5:25am Community Member, 509 Posts

I was thinking along the lines of being able to content edit the page, rather than skipping the htaccess part... But that would be pretty handy as well :)


10 June 2009 at 6:16am (Last edited: 10 June 2009 7:18am), Community Member, 901 Posts

Yeah. The following .htaccess usually does the trick (and you should be able to enter the cms still):

<Files *.ss>
Order deny,allow
Deny from all
Allow from

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_URI} !(\.gif)|(\.jpg)|(\.png)|(\.css)|(\.js)|(\.php)$

# comment/uncomment the 2 lines to enable/disable the down for maintenance page
RewriteCond %{REQUEST_URI} !/(Security/.+|admin).*$ [NC]
RewriteRule .* downformaintenance.html [L,NC]

RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* sapphire/main.php?url=%1&%{QUERY_STRING} [L]

Update Fixed the rewrite condition (added .*)


10 June 2009 at 8:50pm (Last edited: 10 June 2009 8:52pm), Community Member, 509 Posts

Wouldn't it make more sense to use:

RewriteCond %{REMOTE_ADDR} !^xxx\.xxx\.xxx\.xxx

To allow pre defined IP addresses to view the site? That way you can check it properly setting changes live?

Also, what markup do I need to use in this forum to get a code block? (edit: never mind, I found the 'Formatting Help' link)



10 June 2009 at 9:01pm Community Member, 901 Posts

Yes, that's even better if you got a fixed IP that is.


10 June 2009 at 10:05pm Community Member, 509 Posts

Yes, I guess it would require a fixed IP... Luckily I have one in work :).

I guess another way would be to create a sub domain that points to the main site and then redirect that domain when the site is live and use it to access the site while it is down for maintenance? Shouldn't be to hard, you would just have to switch which rules you comment in your htaccess.

Admittedly, I could be making this too complex, but it seems like an idea at least :).


10 June 2009 at 11:44pm Community Member, 11 Posts

You will want to send a HTTP 503 response as well, not a 200.
Probably the easiest way is to use a separate docroot for a 503 page and just switch the vhost to let apache server that file instead of your SilverStripe installation. Conceptually:

   header( "HTTP/1.0 503 Service Unavailable" );
   <head><title>Service Unavailable</title></head>
   <body>My 1337 site is currently unavailable due to maintainance. Please try again in a couple of minutes</body>

Go to Top