简体   繁体   中英

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]

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

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]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM