Code: Select all
order deny,allow
deny from 192.11.22.33
deny from badwebsite.com
You can also use a partial domain name.
Note that blocking by domain name depends on the browser sending the referrer code, which is blocked by some firewalls and browser configurations.
You can limit the blocking to certain files or directories by putting a <files> or <directory> tag around the code. When using the <files> tag you can specify a file name or a file type. See the example below:
Code: Select all
<files image.gif>
order deny,allow
deny from 192.11.22.33
</files>
Code: Select all
ErrorDocument 403 /banned.htm
order deny,allow
deny from 192.11.22.33
deny from 192.77.88
<files banned.htm>
allow from all
</files>
Using the .htaccess lines below, only requests from the specified IP address will be allowed:
Code: Select all
order allow,deny
allow from 192.11.22.33