How to Take a WordPress Site Offline Temporarily
Maintenance mode, a coming-soon page and a genuinely private site are three different things with three different status codes. Pick the one that matches how long you will be down.
Choose by duration and intent:
| Situation | Use | Status code |
|---|---|---|
| An hour of updates on a live site | Maintenance mode | 503 |
| A site not launched yet | Coming-soon page | 200 |
| A staging copy nobody should see | Server password protection | 401 |
| Permanently closing the site | Redirect or a real closure notice | 301 or 410 |
Getting the status code wrong is the part with lasting consequences. A maintenance page returning 200 tells search engines the thin holding page is the page.
Method 1: a maintenance-mode plugin
The straightforward option for planned downtime.
- Install a maintenance-mode plugin.
- Write a short message with an expected return time.
- Confirm it returns 503, not 200 — good plugins expose this as a setting.
- Check that administrators bypass it.
- Enable, then verify in a private window.
Keep the page minimal: no analytics, no fonts, no third-party scripts. It should load even when the reason for the downtime is a struggling server.
Method 2: WordPress's own maintenance file
WordPress creates .maintenance in the root during core and plugin updates, and deletes it afterwards. If an update fails partway, the file is left behind and the site stays stuck — the symptom and fix are in WordPress stuck in maintenance mode.
You can create it deliberately:
<?php
// .maintenance in the WordPress root.
$upgrading = time();
It is crude — no custom message, no admin bypass — but it needs no plugin and takes ten seconds over SFTP. Delete the file to bring the site back.
Method 3: a small custom snippet
For control without a plugin, in a must-use plugin at wp-content/mu-plugins/maintenance.php:
<?php
add_action('template_redirect', function () {
if (current_user_can('edit_posts') || is_user_logged_in()) {
return;
}
header('HTTP/1.1 503 Service Unavailable');
header('Retry-After: 3600'); // seconds
header('Content-Type: text/html; charset=utf-8');
echo '<!doctype html><meta charset="utf-8">'
. '<title>Back shortly</title>'
. '<p>We are carrying out scheduled maintenance and will be back within the hour.</p>';
exit;
});
The Retry-After header tells crawlers when to come back, which is exactly the signal that keeps a short outage from affecting the index.
Delete the file to restore the site — no admin access required, which is useful if the maintenance work broke the admin.
Method 4: server-level password protection
The right choice for staging sites, because it blocks everything including crawlers and bots.
In cPanel, use Directory Privacy on the site's document root. Over SSH with Apache, an .htpasswd file and a Require valid-user directive does the same.
Combine it with Settings → Reading → Discourage search engines, and you have a staging copy that cannot leak or compete with the live site — the reasoning is in installing WordPress on a subdomain.
Coming soon, before launch
A pre-launch site is a different case: it should return 200, be indexable if you want early visibility, and contain something real — what the business does, when it opens, a way to be contacted.
Do not use 503 here. A site that has never launched is not temporarily unavailable, and a long-lived 503 delays indexing you will want later, as why a site is not showing in Google covers.
Before you go offline
- Take a backup, per how to back up a WordPress site.
- Note how to turn the notice off from the filesystem, in case the admin becomes unreachable.
- Schedule for genuinely quiet hours, checked against your analytics rather than assumed.
- Tell anyone who needs to know, especially if orders or enquiries pause.
- Keep essential paths reachable if they matter — a store's order-status page, or a webhook endpoint that must keep receiving callbacks.
Bringing it back
- Disable the plugin, delete the file, or remove the snippet.
- Purge every cache layer, per how to clear the WordPress cache — a cached maintenance page outlives the maintenance.
- Check the homepage, a post and a page in a private window.
- Confirm the response is 200, using an HTTP header check.
- Test a form submission and, on a store, a checkout.
- Watch the error log for the next hour.
A maintenance page still showing after you disabled it is nearly always cache, not the plugin.
Frequently asked
- Not if it returns a 503 status with a Retry-After header for a short period. A maintenance page returning 200, or left up for weeks, can get the pages dropped from the index.
- Maintenance mode is temporary downtime on a live site and should return 503. A coming-soon page is a permanent page for a site that has not launched, and should return 200.
- Every method here exempts logged-in administrators, so you browse the real site normally while everyone else sees the notice.