Jump to:

17452 Posts in 4473 Topics by 1971 members

Archive

SilverStripe Forums » Archive » Down for maintenance?

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

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

Page: 1
Go to End
Author Topic: 2495 Views
  • Qinau
    Avatar
    Community Member
    2 Posts

    Down for maintenance? Link to this post

    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.

  • Sean
    Avatar
    Forum Moderator
    921 Posts

    Re: Down for maintenance? Link to this post

    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

  • jam13
    Avatar
    121 Posts

    Re: Down for maintenance? Link to this post

    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.

  • jam13
    Avatar
    121 Posts

    Re: Down for maintenance? Link to this post

    Just noticed those first two lines could probably reduced to:

    RewriteRule ^maintainance/ - [L]

  • Qinau
    Avatar
    Community Member
    2 Posts

    Re: Down for maintenance? Link to this post

    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.

    2495 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.