HostOnNet Blog

Htaccess Tips and Tricks

Block All traffic

Create .htaccess file with

deny from all

Allow Only Specific IP

Create .htacces with following code

order deny,allow
allow from YOUR_IP_ADDR_1
allow from YOUR_IP_ADDR_2
deny from all

If your IP changes, you can use CIDR format to white list IP range of your ISP.

Block Specific Browser/Version

To block visitors using specific version of browser, create .htaccess file with

RewriteCond %{HTTP_USER_AGENT} Firefox/34.0 [NC]
RewriteRule .* - [F,L]

This will block all access from visitors using Firefox/34.0.

Posted in Apache