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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Archive /

Our old forums are still available as a read-only archive.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo

Down for maintenance?


Go to End


5 Posts   3677 Views

Avatar
Qinau

Community Member, 2 Posts

4 December 2008 at 10:52pm

Hi all,

Just testing SS for a new site, actually a relaunch of an existing site which is the reason for my question.

Is it easy / possible to have a 'down for maintenance' screen, I can't seem to find a suitable solution in the forums or docs (unless I'm missing something obvious). Basically it would need to be just that, a page everyone sees stating something like 'new site coming soon' however the admin would need to be able to see the SS site to work on it and add content.

I don't think htaccess is what I'm after, I can redirect everyone to say a index.html but that will lock out admins too. If I create a new page type, effectively I would have to make sure each is restricted to admin access only (if I follow correctly)

Any help appreciated, thanks.

Great job on SS team too.

Avatar
Sean

Forum Moderator, 922 Posts

5 December 2008 at 12:06am

You could just have one page (home/) as a published page, and the rest of the pages unpublished. This means you have to be logged in as a admin in order to see the unpublished pages.

So, instead of hitting "Save and Publish" you'd just hit "Save" after copy editing pages. If any pages are currently published, just use the "Unpublish" button to make sure nobody can see them in the future.

Hope that makes sense!

Cheers,
Sean

Avatar
jam13

121 Posts

5 December 2008 at 1:57am

The way I normally do this is to develop on a separate domain, and redirect all traffic for the primary domain to a static html page during maintainance. Here's an example .htaccess snippet:

# Maintainance
RewriteCond %{REQUEST_URI} ^/maintainance
RewriteRule .* - [L]
## Uncomment to enable maintainance mode
RewriteCond %{HTTP_HOST} !^dev\.mydomain\.com$ [NC]
RewriteRule .*  maintainance/ [L,R=302]
##

This would go in the .htaccess file near the top (but below the RewriteBase), and you create a folder in the web root called maintainance in which you place an index.html and all it's support files (images/css).

So during maintainance, all access to www.mydomain.com will be temp redirected (302) to the maintainance screen, while access to dev.mydomain.com will work as normal. This should also stop the search engines from incorrectly updating their results with the contents of your holding page.

For additional protection you might also want to password protect the dev domain using basic apache auth.

Avatar
jam13

121 Posts

5 December 2008 at 2:12am

Just noticed those first two lines could probably reduced to:

RewriteRule ^maintainance/ - [L]

Avatar
Qinau

Community Member, 2 Posts

5 December 2008 at 11:09am

Thanks for that suggestion Sean, that is the obvious way I was overlooking so much appreciated. I'll probably lean towards doing it this way.

jam13, thanks for your great suggestion too. After I posted I thought about rejecting access based on IP and have the maintenance page as a custom 403. Your point about the search engines though probably makes that a bad idea.

I appreciate the help guys, you've given me a couple of options to explore. Thanks.