user3145169
user3145169

Reputation: 13

Blocking all requests through .htaccess

I've been reading a lot about this but can't find a definitive anwser. I'm trying to block a few sites from making ANY request to my server. Here's what I have. But it seems some sites can still pull data from me through jquery. I'd also like to block any sub domains of sites, ie "mysite.webs.com". Any ideas? Thanks.

RewriteEngine on
#RewriteEngine on
RewriteCond %{SERVER_NAME} ^(www\.)?webs\.com$ [OR] 
RewriteCond %{SERVER_NAME} ^(www\.)?3dn\.ru$ [OR]
RewriteCond %{SERVER_NAME} ^(www\.)?skyaccess\.se$
#RewriteRule ^ - [F]

Upvotes: 0

Views: 98

Answers (2)

jeroen
jeroen

Reputation: 91734

The value of %{SERVER_NAME} will always be your site or one of its virtual hosts, so I don't think that is going to work.

You could try to block traffic from referring sites:

RewriteCond %{HTTP_REFERER} webs\.com [OR] 
RewriteCond %{HTTP_REFERER} 3dn\.ru [OR]
RewriteCond %{HTTP_REFERER} skyaccess\.se
RewriteRule .* - [F]

Upvotes: 0

tf.alves
tf.alves

Reputation: 917

Will

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

do what you wish? Source: Blocking users/ sites by referrer

Upvotes: 1

Related Questions