Forum Moderators: phranque

Message Too Old, No Replies

Blocking certain referers

I can only find out how to do the opposite of what I want to accomplish

         

MatthewHSE

3:45 pm on Apr 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Quoting from here: [webmasterworld.com]

RewriteEngine on
RewriteCond %{HTTP_REFERER} .
RewriteCond %{HTTP_REFERER}!^http://(www\.)?myowndomain\.net [NC]
RewriteCond %{HTTP_REFERER}!^http://(www\.)?somewhereelse\.com [NC]
RewriteRule \.(gif¦htm)$ http://www.myalloweddomain.net/site/ [R=302,NC]

This allows access from www.myowndomain.net, myowndomain.net, www.somewhereelse.com and somwhereelse.com.

That solution allows access from those four referers and blocks everything else. However, I want to reverse the process, by allowing access from everything else and block only some referers.

Also, it should be noted that I'm trying to block all access to my site, not just access to my images or particular pages.

Can I do that with .htaccess? If so, how?

Thanks a lot,

Matthew

kevinpate

4:24 pm on Apr 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



RewriteEngine on
RewriteCond %{HTTP_REFERER} baddomain\.com [NC,OR]
RewriteCond %{HTTP_REFERER} ugly-domain\.com [NC,OR]
RewriteCond %{HTTP_REFERER} nuther-baddy\.org [NC]
RewriteRule .* - [F]