Redirect All Website Visitors to Under Maintenance Page Using Htaccess

When performing site maintenance and updates you may want to redirect visitors to an "Under Maintenance"  page while allowing your IP access to the entire site.
This can be done using the .htaccess directives below:  (replace xxx.xxx.xxx.xxx with your local IP)

#Start under maintenance redirect
RewriteEngine On RewriteBase /

RewriteCond %{REMOTE_ADDR} !^127\.0\.0\.1
RewriteCond %{REMOTE_ADDR} !^xxx.xxx.xxx.xxx RewriteCond %{REQUEST_URI} !/maintenance\.html$ RewriteRule .* http://www.yourdomain.com/maintenance_page.html [R=302,L] #End under maintenance redirect

  • htaccess
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Manage Files in CPanel

In CPanel go to Files -> File Manageror use a FTP client such as FileZilla

Where can I download a free FTP application?

We recommend downloading FileZilla from here.

If you are behind a router enable passive FTP mode.

If you are behind a router enable "passive mode" in the preferences of your FTP program.

My ftp is slow or disconnects while uploading!

Go into your ftp options and see if passive mode is checked. If it is, uncheck it. If it is not...

Password Protect Directories?

You can password protect directory's within cPanel.In cPanel go to Files -> Directory Privacy