Blocking

We can block visitor based on the host name or host address.This is extremely useful for blocking unwanted visitors, or to only allow the web site owner access to admin section of the web site.

Blocking visitor based on IP address

order allow,deny deny from 255.1.1.0 deny from 123.45.8. allow from all

The above lines tell the Apache Web Server to block visitors from the IP address '255.1.1.0' and '123.45.8.', note the second IP address is missing the fourth set of digits, this means any IP address which matches the firth three set of digits will be blocked.

Blocking of all visitors except yourself

order deny,allow deny from all allow from 192.162.56.78

The above lines tell the Apache Web Server to block all visitors except those with the IP address '192.162.56.78'.you can replace '192.162.56.78' with your ip address.

Blocking of all visitors except yourself

order deny,allow deny from all allow from 192.162.56.78

Block traffic from indicated domain

RewriteEngine on # Options +FollowSymlinks RewriteCond %{HTTP_REFERER} mydomain\.com [NC] RewriteRule .* - [F]

The above lines tell the Apache Web Server to block traffic from the url 'mydomain.com'. The '[NC]' text after the referrer specifies it as not case-sensitive. Which prevents traffic from 'MyDomain.com', 'mydomain.com', 'MYDOMAIN.COM' and so on.

Block mydomain.com but allow sub.mydomain.com

order deny,allow deny from mydomain.com allow from sub.mydomain.com

Note:Blocked visitors will be shown a '403 Forbidden' error message.