If you need to take your website down for updates, redesign work, or troubleshooting without leaving visitors staring at a broken page, maintenance mode is the answer. It shows a simple "we'll be back soon" page to the public while you keep working on the live files behind the scenes.
How Maintenance Mode Works
The most reliable way to do this on shared hosting doesn't depend on your website's software, whether that's WordPress, a custom PHP site, or anything else. You add a few lines to your site's .htaccess file that redirect every visitor to a maintenance page, except for your own IP address, so you can keep testing changes while everyone else sees the notice.
Before you start, you'll need two things ready:
- A simple HTML page (for example, maintenance.html) with your "back soon" message, uploaded to your website's root folder.
- Your current public IP address, which you can find by searching "what is my IP" in your browser.
Turning On Maintenance Mode
In cPanel
- Log in to cPanel and open File Manager under the Files section.
- Navigate to your website's root folder (usually public_html, or the specific folder for an addon domain).
- Upload your maintenance page, e.g. maintenance.html, to this folder if you haven't already.
- Find the .htaccess file. If Show Hidden Files isn't already turned on, enable it from Settings in the top-right corner of File Manager.
- Right-click .htaccess and choose Edit (or Code Editor).
- Add the following near the top of the file, replacing the sample IP address with your own:
RewriteEngine On RewriteCond %{REMOTE_ADDR} !^123\.45\.67\.89$ RewriteCond %{REQUEST_URI} !/maintenance\.html$ RewriteRule .* /maintenance.html [R=302,L] - Click Save Changes.
In DirectAdmin
- Log in to DirectAdmin and open File Manager.
- Navigate to your website's root folder (usually public_html, or the relevant domain folder).
- Upload your maintenance page, e.g. maintenance.html, if it isn't there yet.
- Locate the .htaccess file. Turn on the option to show hidden files if you don't see it listed.
- Click the file's Edit icon to open it in the built-in editor.
- Add the same rewrite rule shown above, with your own IP address in place of the sample one.
- Click Save.
Once saved, open your website in a private or incognito browser window, so you're viewing it as a normal visitor would, to confirm everyone sees the maintenance page while you can still browse the live site normally from your own device.
Turning Maintenance Mode Off
When you're done, open .htaccess again in File Manager and delete the four lines you added, then save. Your website will immediately go back to normal for all visitors.
Tip: Before editing .htaccess, copy its contents somewhere safe or download a copy of the file first. A small typo in .htaccess can take your entire website offline, and having the original to restore from saves time if that happens.
Your IP address can change, especially on mobile data or after restarting your router. If you suddenly see the maintenance page yourself instead of your live site, check that the IP address in the rule still matches your current one.
For more on how this file works and what else you can do with it, see What Is a .htaccess File and What Can You Do With It?