21310 Posts in 5739 Topics by 2604 members
| Go to End | Next > | |
| Author | Topic: | 2041 Views |
-
Down for maintence page in CMS

10 June 2009 at 3:02am
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,
Mo
-
Re: Down for maintence page in CMS

10 June 2009 at 4:41am
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.
-
Re: Down for maintence page in CMS

10 June 2009 at 5:25am
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
-
Re: Down for maintence page in CMS

10 June 2009 at 6:16am Last edited: 10 June 2009 7:18am
Yeah. The following .htaccess usually does the trick (and you should be able to enter the cms still):
### SILVERSTRIPE START ###
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files><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]
</IfModule>
### SILVERSTRIPE END ###Update Fixed the rewrite condition (added .*)
-
Re: Down for maintence page in CMS

10 June 2009 at 8:50pm Last edited: 10 June 2009 8:52pm
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)
Mo
-
Re: Down for maintence page in CMS

10 June 2009 at 9:01pm
Yes, that's even better if you got a fixed IP that is.
-
Re: Down for maintence page in CMS

10 June 2009 at 10:05pm
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
. -
Re: Down for maintence page in CMS

10 June 2009 at 11:44pm
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:<?php
header( "HTTP/1.0 503 Service Unavailable" );
?>
<html>
<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>
</html>
| 2041 Views | ||
| Go to Top | Next > |


