How to enable WordPress maintenance mode using the .htaccess file

November 13, 2023 / WordPress

In this article, you will understand how to enable WordPress maintenance mode using the .htaccess file.

Let us follow the steps-

  1. Log in to cPanel.
  2. Select the “Files” option and click on the “File Manager” sub-option.
    file manager
  3. Locate the “public_html” directory and then the “.htaccess” file.
    public_html
  4. If the .htaccess file is not noticeable, then on the right side of the page, click Settings, check the box with the text Show Hidden Files, and click the “Save” button.
  5. Click on the “Edit” button by right-clicking on the “.htaccess” file.
    edit
  6. Enter the below code in the .htaccess file-
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_URI} !^/maintenance\.html$
    RewriteRule ^(.*)$ https://example.com/maintenance.html [R=307,L]
    WordPress maintenance mode
  7. Click on the “Save Changes” button in the top right corner.
    save changes

This way you can enable WordPress maintenance mode using the .htaccess file.

Hope you liked our article. For more information, visit our KB section regularly.

Dominos Search