I am no .htaccess guru, and someone may come-up with a better way to do this :] Let's asume you have two sites you don't want referring to yours (and we shall call them "badguys.com", "badgirls.com", & "spammers.com"), you would use the following to block their referred links:
Code:
RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} !^http://([-a-z0-9]+\.)?badguys\.com [NC,OR]
RewriteCond %{HTTP_REFERER} !^http://([-a-z0-9]+\.)?badgirls\.com [NC,OR]
RewriteCond %{HTTP_REFERER} !^http://([-a-z0-9]+\.)?spammers\.com
RewriteRule .* - [F]
Note, in the above, that the last "RewriteCond", that it does not end in "[NC,OR]". If you only have one referrer being blocked, put it at the end of the line. If you have more than one, put it on the end of each "RewriteCond" statement
except the last. You'll also note a "\" before the "." in the domains - leave it, as it is syntax.
The above will give a 403 error (the commonly called "Forbidden" error), if the user's browser actually returns a referrer header from the listed domains or any subdomains on them. An example of a 403 error can be seen
here. The line that says "# Options +FollowSymlinks"...remove the "#" if your are not sure rather or not your server has FollowSymLinks enabled, and put the "#" back, if you get a "500 Internal Error".
You could change the last line to read "
RewriteRule .* http://yoursite.com/bad.html [R,L]" , which would show a customized page telling them of the bad referrer's nasty actions, instead of the 403 error which most users would wonder why they were denied-access for
Their are many sites that explain the above in more detail. I suggest you look at
www.doriat.com or just do a search for "mod_rewrite" and ".htaccess"
If this doesn't help, let me know :tu: