Animation


DIVs vs. Tables

Float Layouts

Inline Blocks

Block Layouts


Centering

Split Bkgrd

Graphic Borders

Horizontal Lists

CSS Colors


.htaccess

Block IPs

Down for Maintenance

Page Redirect

Custom Error Pages


Escaping query strings

PNG transparency

Google App testing

Flash Optimizing

Avoid AS Statics

SEO Optimization



.htaccess for Site Maintenance

There are many times when updating your web site that you will want to stop people from visiting while you do it. That's to prevent people from catching things in the middle of an update that can lead to missing files, images etc. It is easy to simply advise them that the site is down for a while. Usually site updates only take a few minutes anyways.

Backup your original .htaccess file

It is vital that you back up the original .htaccess file that is on your site. Then edit the original file to change or add what you need. Do not change or remove anything you don't understand. This can disable your web site if a mistake is made. But fortunately you'll have a backup of the original should you need to recover.

Example .htaccess file

Order Deny,Allow
Deny from All
Allow from 212.64.52.121
ErrorDocument 403 "Down for maintenance"

.htaccess allows you to deny all visitors but also permit select visitors. In this case I instruct the server to first process the 'Deny' list, then the 'Allow' list. So, first the server prohibits all visitors, then it sees that I'll allow visitors from the given address. That given address would be the address from which you access the web.

When you give your own address in that way you still have the ability to visit the site for testing, but no one else will be able to view the site. This is ideal for a safe test environment when you upload changes.

To find out what your IP address is, simply visit http://www.whatismyip.com and copy the address that is prominently displayed. Will, actually, why don't I just tell you your IP? Your IP is 23.20.9.71

Finally, the "ErrorDocument" statement relates the refusal to show the website (403) with a message to explain the situation to the visitor.



Did you find this article userful for your website?
If so, why not provide a link to it? Just copy the following to your web page:

<a href='http://upwithabang.com/articles/htaccess-site-maintenance.html'>htaccess for site maintenance</a>