Say you want to deny access to your entire site except when you access it. The following htaccess code does just that. Instead of a Static IP you could also use a hostname, or part of a hostname..
AuthName "Site Administration" AuthUserFile /web/user/askapache.com/.htpasswd AuthType basic Require valid-user Order deny,allow Deny from all Allow from 24.11.54.6 Satisfy Any
More information about this technique can be found in the htaccessElite.com Authentication Forum
Specific posts:
- Order, Allow, Deny
- Block everyone except 1 IP Address
- Deny based on domain name
- Deny a Block of IP Addresses
- Deny A User based on their IP address
- Basic authentication example