How to Turn Your Website Off

There are times when you may need to take your website offline, whether temporarily or permanently. This could be necessary for scheduled maintenance, applying important security updates, or resolving critical issues that require the site to be inaccessible to users. Whatever the reason, this guide will walk you through various methods to turn your website off safely and efficiently.

If this is temporary - maintenance, an update, a problem you are fixing - use maintenance mode (method 4) rather than the first three. Google's guidance on pausing an online business is to return a 503 for short periods and to avoid blocking with 403, 404 or 410 responses. Methods 1 and 2 produce exactly those, so a site taken down that way can lose its search rankings while it is off.

1. Disable with .htaccess IP Restriction

If you need to take the site offline but still need to access it yourself, you can block access to your website by allowing only specific IPs to view it.

Steps:

  1. Open your .htaccess file in the root directory (usually /public_html/).
  2. Add the following code:
Require ip YOUR-IP-HERE

That single line denies everyone except the address you list. Older examples you may find elsewhere use Order deny,allow with Deny from all; avoid those, because they rely on a legacy Apache compatibility module and on a server where it is not loaded they return a 500 error for the whole site rather than failing quietly.

    • Replace YOUR-IP-HERE with your own IP address. (Check your IP here!)
    • To allow multiple IPs, list them on the one line separated by spaces - Require ip 203.0.113.7 198.51.100.4 - or add further Require ip lines.

Result: Only specified IPs will be able to access the website; others will be blocked.

2. Remove Website Files

A direct method to take down your website is to remove or move its files from the public directory. This will cause your website to return a 404 error (or a custom error page if set up) to visitors.

Steps:

  1. Log in to cPanel or FTP:
    • Access your hosting account (typically through cPanel or FTP).
      • If using cPanel: Navigate to File Manager.
      • If using FTP: Use an FTP client (e.g., FileZilla) to connect to your server.
  2. Navigate to the Website Directory:
    • In File Manager or the FTP client, go to /public_html/. This is where your website’s files are stored.
      • If your website is in a subfolder or add-on domain, navigate to the appropriate subdirectory.
  3. Create a Backup:
    • Before removing any files, create a backup in case you need to restore them later.
      • Select all the files in the website folder.
      • Click Compress in cPanel or download them using FTP.
      • Store the backup safely on your local computer or a cloud storage service.
  4. Delete or Move Files:
    • In File Manager or the FTP client, select all files and either:
      • Click Delete to remove the files.
      • Or Move them to a different, non-public folder (e.g., /backup/).

Result: Once files are deleted or moved, anyone visiting your website will receive a 404 error. If you have a custom 404 page, that page will be shown instead.

3. Change DNS Settings

Disabling your site at the DNS level will prevent your domain from resolving.

Steps:

  1. Log in to your domain registrar/Nameserver Provider (e.g., Krystal, GoDaddy, Namecheap).
  2. Locate the DNS settings for your domain.
  3. Delete the A record for the domain.
    • Do not point it at 127.0.0.1. That is the loopback address - it is not invalid, and it does not send visitors nowhere. It sends every visitor to their own computer, so anyone running a web server locally will be shown that instead of your site.

Result: Your domain will no longer point to your server, effectively taking the site offline for all users.

Two things to know before using this method. DNS is cached, so the change is neither immediate nor immediately reversible - visitors and their ISPs may keep the old answer for as long as the record's TTL. And on cPanel, mail for a domain with no MX record follows the A record, so deleting it can stop email for the domain as well as the website.

4. Temporarily Disable via Maintenance Mode

If you just need to temporarily take your site down, maintenance mode is a good option.

Steps:

  1. Create a maintenance.html file with a message for your visitors.
  2. Serve that file to visitors by adding the following code to .htaccess. Replace YOUR-IP-HERE with your own IP address so that you can still reach the site while it is down - write it with the dots escaped, for example !^203\.0\.113\.7$:
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^YOUR-IP-HERE$
RewriteCond %{REQUEST_URI} !^/maintenance\.html$
RewriteRule ^ - [R=503,L]
ErrorDocument 503 /maintenance.html

Result: Visitors see your maintenance page, and the server returns a 503 Service Unavailable status with it. That status is the important part: it tells search engines the outage is temporary and to come back later, rather than that the page has gone. You keep your own access from the IP address you listed. Remove the rule when you are finished.


How did we do?

Powered by HelpDocs (opens in a new tab)
© Krystal Hosting Ltd 2002–