Sometimes you need your website out of the way for a little while. Maybe you're redesigning it, moving content around, fixing something that broke, or you simply don't want visitors landing on a half-finished page.
The good news is that you don't need to delete anything or cancel your hosting. You can put your site into maintenance mode, show visitors a short "down for maintenance" message, and switch it back on when you're ready.
This guide shows you how to do it in cPanel, DirectAdmin and PanelAlpha. Pick the section for the control panel you use. Each one takes a few minutes.
Before You Start
In cPanel and DirectAdmin, maintenance mode means adding three lines to your site's .htaccess file. If you've never worked with this file before, our guide to the basics of the .htaccess file explains what it is and where it lives.
The maintenance rule blocks every page on the site, including the WordPress admin area if you run WordPress. Finish any changes you need to make inside WordPress before you switch it on.
The Maintenance Code
This is the code you'll add in cPanel and DirectAdmin:
ErrorDocument 503 "<h1>Site temporarily down for maintenance</h1>"
RewriteEngine On
RewriteRule .* - [R=503,L]
Put these three lines at the very top of .htaccess, above everything else in the file. Apache reads the file from top to bottom. On a WordPress site, the existing WordPress rewrite block would otherwise serve your pages before the maintenance rule is ever reached, and your site would stay online.
You can change the text between the <h1> tags to any message you like, as long as it stays on one line and inside the double quotes.
Why a 503 Status Is the Right Choice
The code tells the server to answer every request with a 503 "Service Unavailable" status. That status matters for search engines. It tells Google and other search engines that the downtime is temporary, so they come back later instead of treating your pages as gone or indexing your maintenance message in place of your real content.
Keep the downtime as short as you can. If a site returns a 503 for many days in a row, search engines may start to treat the pages as no longer available.
How to Take Your Site Offline in cPanel
- Log in to your cPanel.
- Open File Manager.
- Go to the
public_htmlfolder. - If you can't see
.htaccess, click Settings in the top-right corner, tick Show Hidden Files (dotfiles) and save. - Right-click
.htaccessand select Edit. - Paste the maintenance code at the very top of the file.
- Click Save Changes.
- Visit your website to check that the maintenance message appears.
If there's no .htaccess file at all, even with hidden files showing, create a new file named .htaccess in public_html and paste the code into it.
How to Take Your Site Offline in DirectAdmin
- Log in to your DirectAdmin dashboard.
- Open File Manager.
- Go to
domains/yourdomain.com/public_html/, replacingyourdomain.comwith your own domain. - Find the
.htaccessfile. If you can't see it, turn on the option to show hidden files. - Select
.htaccessand click Edit. - Paste the maintenance code at the very top of the file.
- Save the file.
- Open your website in a private or incognito browser window to check that the maintenance message appears.
A private window matters here because your normal browser may still show you a cached copy of the live site.
How to Take Your Site Offline in PanelAlpha
PanelAlpha is the dashboard behind HostAfrica's WordPress hosting, and it has a built-in maintenance mode, so there's no file to edit.
- Log in to your PanelAlpha dashboard.
- Find your site and click the three dots under Actions on the right.
- Select Manage from the drop-down menu.
- Click the Advanced tab and go to Developer Settings.
- Click the Maintenance Mode toggle to turn it on for your site.
Bringing Your Site Back
When you're ready to go live again, undo the change.
In cPanel or DirectAdmin:
- Open
.htaccessin the File Manager, the same way you did before. - Delete the three maintenance lines at the top of the file. If you'd rather keep them for next time, comment them out instead by adding
#at the start of each line. - Save the file.
- Check your website in a private or incognito window to confirm it loads normally.
If you kept a .htaccess.bak copy, you can instead delete the edited file and rename the copy back to .htaccess.
In PanelAlpha:
- Go back to Advanced and then Developer Settings for your site.
- Click the Maintenance Mode toggle to turn it off.
That's it. Your site is back online, and search engines will pick up where they left off.
