Saturday, 09 August 2014 10:37

Down For Maintenance

Have you ever needed to work on a site while stopping access for other users. These .htaccess mods will allow you to do just that

Create a offline.html file and place it in your websites route directory. A sample copy is attached to this article

Edit the .htaccess file to incude

RewriteEngine On
RewriteCond %{REMOTE_ADDR} !^999\.999\.999\.999
RewriteCond %{REQUEST_URI} !^/offline\.html$ [NC]
RewriteCond %{REQUEST_URI} !\.(jpe?g?|png|gif) [NC]
RewriteRule ^(.*)$ http://yourdomain.com/offline.html [R=307,L]

Where yourdomain.com is your domain name and the ip address 999\.999\.999\.999 is the ip address you want to allow

Read 1451 times Last modified on Saturday, 09 August 2014 11:28