How to activate maintenance mode via .htaccess in WHM cPanel

  Uncategorized

Introduction:

In this section, we can see how to activate the maintenance mode via .htaccess

Prerequisites:

  1. Server root login credentials. (or)
  2. cPanel login details

Step 1:

ssh root@Ip

Step 2:

Now go to the domain’s document root on the server or select file manager on WHM cPanel

Step 3:

Open the .htaccess file

vi .htaccess

Step 4:

Edit the .htaccess

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^000.000.000.000
RewriteCond %{REQUEST_URI} !^/maintenance.html$
RewriteRule ^(.*)$ https://domain.com/maintenance.html [L]
</IfModule>

Step 5:

Now create the maintenance.html file

vi maintenance.html

Step 6:

Edit the maintenance.html by entering this message.

This website is under maintenance

Now if you browse the domain you will see the “This website is under maintenance” message on the page.

Conclusion:

Now by following the above steps, we can enable the maintenance mode for the domain on the cPanel

LEAVE A COMMENT