Last updated May 22, 2012. Created by jfall on March 17, 2008.
Edited by alexanderpas, bekasu. Log in to edit this page.

Drupal 6.x and later provides a 'built-in' phptemplate approach to theming the "Site offline" maintenance page - see http://drupal.org/node/195435

In Drupal 5.x, many posts have suggested hacking core to customize this theme, but this is a poor idea, not necessary, and doesn't even give a good result. Here are a couple of good approaches that were proposed by Nax (http://drupal.org/user/25511), each with its own advantages:

  • Define a custom template file to theme the maintenance page: http://drupal.org/node/58562#comment-266358
    • Advantage: integrated with theme; Uses the "Site off-line message" at admin/settings/site-maintenance so easy to configure and change message through admin interface.
  • Define a static html page for the maintenance page, and then re-direct to it by inserting the following override into template.php:
    function phptemplate_maintenance_page($content, $messages = TRUE, $partial = FALSE) {
      drupal_goto('path/to/your/site-offline.html');
    }
    See http://drupal.org/node/58562#comment-281490
    • Advantage: very simple; no need for custom theming for the maintenance page.
    • Disadvantage: does not use the "Site off-line message" in the admin panel, so could confuse an admin who didn't set the site up.

Both of these methods work, so choose the one that seems best for your situation.
Some advice when developing your custom maintenance page:

  • Remember that the site is offline - you can't make any calls, directly or indirectly, to the database - so be careful what you call.
  • Remeber that your .htaccess files will limit the folders users can access, so be sure to put any static html into a folder users can access (like the root folder, for example).

If you have any suggestions or other methods for doing this, please post a comment here.

Looking for support? Visit the Drupal.org forums, or join #drupal-support in IRC.

Comments

I can't seem to get this to work and I don't know why as your instructions are fairly straight forward (unless something is being left out in the assumption that we'd just know).

Update: I've detailed my solution at http://drupal.org/node/275271

I wanted to have a unique simple html flash page posted while working on the site.
I posted the above function into my themes/garland/template.php the redirec works well.
however, i cannot access the admin page to work on the site..

i plug in the url: http://mysite.com/?q=admin/ and it still redirects to my offline page grrrrrrr!

so, i commented out the code and back to the dry 'drupal-ly looking' off line page.

any ideas on how i can have the custom html redirect and still access my admin pages so i can work on the site?
thanks
jack

__________________________________________________________________________________________________________
''The secret though is just keep walking through life without analyzing it too much or clinging to it too much. Just walk on.'' - Marilyn Silverstone, Magnum Photographer & Buddhist Nun, b. March 9, 1929, October 1999.

''The secret though is just keep walking through life without analyzing it too much or clinging to it too much. Just walk on.'' - Marilyn Silverstone, Magnum Photographer & Buddhist Nun, b. March 9, 1929, October 1999.

http://drupal.org/node/56995

i had the syntax wrong;

Once you have turned your site off-line using admin » settings » site maintenance(admin/settings), you can log back in by visiting:

http://example.com/?q=user

Note: Use the literal word user, not your username or user id. Do, however, replace example.com with the proper URL parts pointing to your website.

so far, using the redirect code snippet in the garland template.php on drupal 6.5 seems to be working.
thanks
jack
___________________________________________________________________________________________________________
''The secret though is just keep walking through life without analyzing it too much or clinging to it too much. Just walk on.'' - Marilyn Silverstone, Magnum Photographer & Buddhist Nun, b. March 9, 1929, October 1999.

''The secret though is just keep walking through life without analyzing it too much or clinging to it too much. Just walk on.'' - Marilyn Silverstone, Magnum Photographer & Buddhist Nun, b. March 9, 1929, October 1999.