Skip to main content

How to Take a Compromised Website Offline Without Deleting Evidence

If you suspect your website has been compromised, you can take it offline to prevent further malicious activity while preserving the evidence needed for a security investigation. This procedure allows a customer to restrict public access to the site...

If you suspect your website has been compromised, you can take it offline to prevent further malicious activity while preserving the evidence needed for a security investigation. This procedure allows a customer to restrict public access to the site without deleting files or databases.

Important: Do not delete any files, folders, or databases during this process, as doing so will destroy evidence required to identify the extent of the breach.

Before you begin

You will need:

  • Access to your hosting control panel (such as cPanel or Windows Control Panel)

  • The specific domain name or IP address of the compromised site

Take the website offline

Depending on your hosting environment, use one of the following methods to restrict access.

Using a maintenance page or "under construction" status

This method keeps the site's files intact but displays a notice to visitors.

  1. In your hosting control panel, locate the Website or Domain management section.

  2. Select the specific domain you wish to take offline.

  3. If your control panel includes a "Maintenance Mode" toggle, select Maintenance Mode and click Enable.

  4. If a maintenance mode is not available, use a tool like SiteLock or a similar service to redirect all traffic to a static "Site Offline" page.

Using a .htaccess file (cPanel/Apache)

This method blocks all incoming traffic to the website via the server configuration.

  1. Open the File Manager in your control panel.

  2. Navigate to the root directory of the website (usually public_html or a specific folder named after your domain).

  3. Locate the .htaccess file.

  4. Edit the .htaccess file and add the following code at the top of the file:

RewriteEngine On
RewriteRule ^(.*)$ http://example.com/maintenance.html [R=302,L]

  1. Replace example.com with your domain and ensure a maintenance.html file exists in the directory.

Using a Windows Firewall or IIS rule (Windows Control Panel)

If you are using a Windows-based server, you can block traffic at the server level.

  1. Log in to the Windows Control Panel.

  2. Navigate to IIS Manager.

  3. Select the website from the left-hand pane.

  4. Select IP Address and Domain Restrictions from the Features View.

  5. Click Edit Feature Settings in the Actions pane.

  6. Select Deny to All or specify a range of IP addresses to block.

  7. Click Apply.

Confirm the result

  • Navigate to your website's URL from a device not on your local network (such as a mobile phone using cellular data).

  • Verify that the site displays a maintenance message or fails to load for the public.

  • Confirm that the site's files and database remain intact in your file manager.

If the site remains accessible to the public

If the site is still accessible after applying the changes, the issue may be related to a caching layer.

  • Clear your local browser cache or attempt to view the site in an Incognito/Private window.

  • Purge the cache if you use a Content Delivery Network (CDN) like Cloudflare.

  • Check your local DNS cache by running ipconfig /flushdns in your command prompt (Windows) or sudo dscacheutil -flushcache (macOS).

Limitations

  • This procedure does not remove malware or "clean" the site; it only restricts access to the site.

  • This procedure does not change your DNS records or your IP address.

  • If you use a CDN, you may need to perform additional steps within the CDN's dashboard to ensure the "offline" status is reflected globally.

Did this answer your question?