The name of the file is
.htaccess (with a dot in front of the h)
and may in addition to the directives mentioned above include configuration paths like
php_value include_path ".:/usr/local/lib/php: etc : etc.
Block bad bots like this: (# indicates comments in the file).
RewriteEngine on #Only include this line once to enable the rewriting engine
#These lines block agents commonly used to harvest URLs and email addresses.
#One of the uses of such agents is to gather URLs for subseqent referral spamming
#by a large number of hosts. Thus, preventing their access may, by itself, decrease
#the amount of referral spam you receive.
RewriteCond %{HTTP_USER_AGENT} ^Microsoft\ URL\ Control.*$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Mozilla/4\.0\ .*Win\ 9x\ 4\.90.*$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*Indy\ Library.*$ [NC,OR]
#These lines block bots that use your bandwidth for their own commercial reasons.
RewriteCond %{HTTP_USER_AGENT} ^abot.*$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^aipbot.*$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^Linkwalker$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*nameprotect.*$ [NC,OR]
RewriteCond %{HTTP_USER_AGENT} ^.*TurnitinBot.*$ [NC,OR]
Deny unique IP's
deny from ***.***.***.***
Deny IP regions
deny from 192.168.112.0/24
Explained at the
DNSStuff site in the lower left corner in the field named CDIR/Netmask
Apache Tutorial: .htaccess files
Related link:
Apache HTTP server project. (Note: the "Get involved menu" with sub menus, "Mailing list", "Bug Report" and "Developer Info").
P.S. deny from 0.0.0.0/1
Will deny the IP range 0.0.0.0 through 127.255.255.255 [2147483648 IPs] from accessing your site.
#For serious offenders or spammers who send referral spam directed to several different
#domains, I block access by IP address. Listed here are the worst offenders. This method
#may be more conservative than some people want to be; if so, just leave this part out of
#your .htaccess file.
<Files 403.shtml>
order allow,deny
allow from all
</Files>
#examples
deny from ........ (Long list excluded)
You may use this technique to set up an informal extranet. (An extranet is a network where only your current customers have access.)
Join the DNSStuff forum if you want to be an expert on this.