HostOnNet Blog

Htaccess Tips and Tricks

Looking for Linux Server Admin or WordPress Expert? We can help.

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

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.