Put Drupal Sites in Maintenance Mode Manually

Put your Drupal Site in Maintenance Mode Manually

Drupal allows to set a website offline with a few clicks via the admin interfacte.

However, we’ve seen situations where the admin interface becomes unavailable, often via a white screen of death.

In this tutorial, I’m going to show you a manual way to force your Drupal 7 site in maintenance mode.

Step #1. Edit the settings.php file

  • Edit the file sites/default/settings.php file, using a FTP client or through cPanel:
Put your Drupal Site in Maintenance Mode Manually
  • At the very end of settings.php, add the code below:

{codecitation php}$conf[‘maintenance_mode’] = 1;{/codecitation}

Step #2. End result

Your site will now display the “Site under maintenance” page:

Put your Drupal Site in Maintenance Mode Manually

Step #3. Put your site back online

Remove the line of code from Step 1, or change the value to 0 to put your site online again:

{codecitation php}$conf[‘maintenance_mode’] = 0;{/codecitation}


  • Valentin Garcia

    Valentin discovered Joomla in 2010, and since then he has considered it as the best CMS. Valentin has been coding extensions and templates for Joomla for many years and truly enjoys helping people build their own websites with Open Source tools. He lives in San Julián, Jalisco, México.

0 0 votes
Article Rating
Notify of

Newest Most Voted
Inline Feedbacks
View all comments
Layla Loxton
Layla Loxton
8 years ago

Eliminate the type of rule from Phase # 1, or modify the value to 0 to put your site online again:
[url=http://www.harrowtuitioncentre.co.uk/mathstutorharrow/]maths tutor harrow[/url]

2 years ago

Sadly, this doesn’t appear to work in Drupal 9.2.7 where I have exactly the situation you describe: a maintenance page and nothing, not even ?q=user works.

Also, if I run update (having allowed that via settings.php) when the update is finished, only the “front page” option is available  – no access to administration pages.

The recommended solution is drush but that requires SSH or editing a blob in the database.

It used to be so simple: go into the DB, change a flag from 1 to 0 and get on your way.

So much progress isn’t. 🙁

2 years ago
Reply to  Anonymous

Yes – you are correct unfortunately.

Drush is definitely the way to go on any Drupal site though – it’s worth putting a site where you can use it I think (if you can)…

Would love your thoughts, please comment.x