Blocking Access to Your Website While Doing Maintenance
Background
This is a quick hack to block access to your website while you do maintenance to it. Not very elegant, but it gets the job done. The basic idea is that you don't want others to access your site because you're making changes, but you still need to be able to access your site to assess the modifications. This is useful, for example, if your site makes use of PHP where working offline is difficult since server preprocessing is necessary. This method will give you regular access to your site while everyone else who tries to access it will get a 403 error during the maintenance.
HOWTO
- Find your IP address as seen by web servers. Sites like this one will show it to you in your browser.
-
Add the following to
your .htaccess file at the root of the site:
AuthName "Site Maintenance"Where XXX.XXX.XXX.XXX is the IP address for the computer you are using.
AuthType Basic
<Limit GET POST>
order deny,allow
deny from all
allow from XXX.XXX.XXX.XXX
</Limit> - After the maintenance is done, remove those lines from you .htaccess file.