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!



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... ;)

I am no longer active at the Forum. Please do NOT send me Personal Mails,
they will no longer be replied to.
My Github OC Site:
4'300 + FREE OC Extensions, on the World's largest Github OC Repository Archive Site.

User avatar
Legendary Member


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]


For Friendly Professional Support - Click Here

User avatar
Guru Member


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

Users browsing this forum: No registered users and 13 guests