I am trying to ban some bots by writing a RewriteCond rule in htaccess file. Is the following ruleset correct if I add the following:
## block traffic from particular referrers
RewriteEngine On
RewriteCond %{HTTP_REFERER} ^http://(www\.)?example-subdomain.parent.com [NC,OR]
RewriteCond %{HTTP_REFERER} ^http://(www\.)?example-2-domain.net [NC]
RewriteRule (.*) - [F]
As you see I wish to ban by domain name and not by IP address. Is it OK if I remove the (www.) part?
Update: My question is mainly related to RewriteCond correct syntax for the urls.
Thanks