Probably a silly question, but I've done a search and didn't find an answer.

I was doing quite a few major changes to my site earlier today, and realised that it would be a good idea to take the site offline while I was at work. I'm sure I remember encountering something like this somewhere in Drupal, but can't remember where (though I may be imagining it, or getting confused with one of some other CMS I tested)

Comments

Steven’s picture

It depends what you want to do... disable the site for anyone except you, or disable the site completely.

In the former case, you'd need to ban every IP except yours, this is easiest done through htaccess. In the latter case, you can just rename index.php to something else and replace it with a plain index.html or something.

--
If you have a problem, please search before posting a question.

kbahey’s picture

Incidentally, I am planning a site move over next weekend, so I am looking into something similar as well.

My plan is to provide an index.html saying the web site will be down for scheduled maintenance for a few hours.

Note that to use the index.html approach, you have to move .htaccess to another name as well, or add index.html on the Index line.

The existing .htaccess will cause Apache to ignore any type of index file except index.php

Another caveat (which I do not know how to get around) is when users click on a Google link or any other deep link to your web site, they will get a 404, and not the index.html. Any easy way around that?

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

bertboerland’s picture

... they will get a 404, and not the index.html. Any easy way around that?

defne index.html as 404 in apache, redirect on html level with a notice etc

--
groets
bertb

--
groets
bert boerland

clairem’s picture

Thanks for the replies, though I'm disappointed!

Hacking .htaccess seems a bit crude, and not what I was after. It's not accesible to non-technical administrators, and I don't like generating 404 errors -- it would look like the site is broken.

It would be nice if there was some simple way of disabling all access for particular categories of user. A login page would obviously still have to be accesible (at http://www.mysite.dom?q=user/login ), but otherwise users would be presented with a simple message saying "this site is temporarily off-line for maintenance. Please try again later"

Tweaks could allow for customisable off-line messages, and ideally for an optional time-constraint on the "offline" mode -- in case the admin forgets to turn it back on again.

willmoy@www.civicspacelabs.org’s picture

This would suit me right this moment. Could you file it as a feature request please? (Create content | issue and choose feature request as the issue type).

clairem’s picture

Done: see http://drupal.org/node/15922

I've never made a feature request before, so I hope I got it right!

Lappie’s picture

Compare the behavior of PhpBB, for instance, that has a master switch for the entire forum in its control panel. If you take the website 'offline', every other user than the administrator gets a warning about the site being down.

Very convenient!

Jaza’s picture

I'm sure I remember encountering something like this somewhere in Drupal, but can't remember where (though I may be imagining it, or getting confused with one of some other CMS I tested)

Perhaps you were getting confused with Mambo? Although I haven't used Mambo nearly as much as Drupal, I did evaluate it for a little while, and I remember that it has this feature. On the main settings page for a Mambo site, you can tick a box that says 'site currently offline', and enter in a message that users will see when they visit the main page (actually, when they visit any page I think). Administrators can still log in and manage the site... this would probably be harder to implement in Drupal (though not impossible), since Mambo's admin section is basically a separate site.

I think Mambo also has that time constraint you mentioned (i.e. 'keep this site offline until such-and-such date and time')

Jeremy Epstein - GreenAsh

Jeremy Epstein - GreenAsh

clairem’s picture

Jaza, you may well be right. I tried Mambo before installing Drupal, and the way you describe it rings a bell. Thanks for explaining it all.

kbahey’s picture

http://drupal.org/node/32622
--
Drupal development and customization: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba

xeniac’s picture

Ok Drupal 4.7 has this, but sombody needs the Feature now... ;)

I think the Frontpage Module could make the Approch.

Make a "this Site went Offline" for Users and Anonymous. You could always login with ?q=user/login

kbahey’s picture

This is only a partial solution.

Visitors to the main page will get the site offline message.

However, those who come directly to a node (says node/123) will never see that message.

Here is a work around for 4.6 and earlier that will do the same thing.
--
Drupal development and customization: 2bits.com
Personal: Baheyeldin.com

--
Drupal performance tuning and optimization, hosting, development, and consulting: 2bits.com, Inc. and Twitter at: @2bits
Personal blog: Ba