Shane Duffy

Posts Tagged ‘.htaccess

At some stage most of us have needed to work on our websites and move things around, For most people would do this live on the website and this does not make for a great experience for your customers and clients who end up visiting broken and half finished pages. Or even worse the search engine crawlers that come along and find sample text on your pages.

One of the neat tricks of a .htaccess file is been able to enable a maintenance page for all your visitors to your website but still been able to access the website yourself for testing and development.

RewriteEngine On
RewriteBase /
RewriteCond %{REMOTE_HOST} !^86\.43\.107\.123
RewriteCond %{REMOTE_HOST} !^86\.43\.107\.201
RewriteCond %{REQUEST_URI} !/maintenance\.html$
RewriteRule .* /maintenance.html [R=302,L]

The above when placed in a .htaccess file will redirect all clients who are not coming from 86.43.107.123
or 86.43.107.201 to the maintenance.html webpage

Simple yet very handy to have!

Advertisements

Subscribe to this blog now!

Top Clicks

  • None
November 2017
M T W T F S S
« Feb    
 12345
6789101112
13141516171819
20212223242526
27282930