How to take website in maintenance mode with .htaccess file?

kumkumsharma

Administrator
Staff member
You can add below code to your .htaccess file to put your website in maintenance mode. With this code if anyone try to access the website will be redirected to maintenance.php mode.

Code:
RewriteEngine On
RewriteRule !^maintenance.php$ /maintenance.php [R=302,L]
But if you want to use your website for editing but want to redirect other clients to maintenance page then you can add below code in your .htaccess file:

Code:
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^109\.23\.45\.0$
RewriteRule !^maintenance.php$ /maintenance.php [R=302,L]
You have to enter your IP address in pace of 109.23.45.0.
 
Top