Post by Jeens » Mon Aug 03, 2020 9:58 pm

I would like to block visitors coming from certain domains and subdomains in my .htaccess file.
I have found following code:

RewriteEngine on
RewriteCond %{HTTP_REFERER} !^.*(1234|asdf).* [NC]
RewriteRule .* - [F]

The problem is, I would like to block not only one domain as in "domain.tld" but also "subdomain.domain.tld" and all tld variants af this.
I take it the * in the code above does that?

Also I am not sure, if you have to put a \ before the . as?

The reason I ask is, I have read like 20 guides on that topic and every single one has a different code.

Thank you!

New member

Posts

Joined
Sat Jul 11, 2020 5:16 pm

Post by IP_CAM » Tue Aug 04, 2020 5:41 am

Well, one of the problem is, that not every Server 'handles' .htaccess
in exactly the same way, as it looks. Best is, to try, what's working... ;)
Ernie

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by uksitebuilder » Tue Aug 04, 2020 10:00 pm

RewriteEngine on
RewriteCond %{HTTP_REFERER} ^somedomain\.com [NC] OR
RewriteCond %{HTTP_REFERER} ^subdomain\.somedomain\.com [NC]
RewriteRule .* - [F]

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom
Who is online

Users browsing this forum: No registered users and 73 guests