A bot is visiting my website and leaves in 0 seconds so makes 100% exits. I'm trying to prevent this using an htaccess file in Wordpress.
The first lines blocks direct access of ref attack,
and the second lines prevents spam domains,
but they don't work together.
How can I combine these lines in htaccess?
I have updated the code and entered the complete htaccess :
RewriteEngine On
# ref spam block
RewriteCond %{THE_REQUEST} \?(ref=.*)?\ HTTP [NC, OR]
RewriteRule .? http://www.hqtunes.com%{REQUEST_URI}? [R=301,L]
and
<IfModule mod_rewrite.c>
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*uptime-as\.net [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*uptime-us\.net [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*uptime-eu\.net [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*hulfingtonpost\.com [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*apanews\.com [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*adcash\.com [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*aliexpress\.com [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*bestwebsitesawards\.com [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*buttons-for-website\.com [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*bycontext\.com [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*cenokos\.ru [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*cenoval\.ru [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*cityadspix\.ru [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*darodar\.com [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*econom\.co [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*edakgfvwql\.ru [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*gobongo\.info [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*ilovevitaly\.com [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*ilovevitaly\.info [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*ilovevitaly\.org [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*ilovevitaly\.ru [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*iskalko\.ru [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*jollygame\.net [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*luxup\.ru [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*max-start\.com [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*o-o-6-o-o\.ru [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*o-o-8-o-o\.ru [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*priceg\.com [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*savetubevideo\.com [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*screentoolkit\.com [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*semalt\.com [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*seoexperimenty\.ru [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*slftsdybbg\.ru [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*socialseet\.ru [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*superiends\.org [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*vodkoved\.ru [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*websites-reviews\.com [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*websocial\.me [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*ykecwqlixx\.ru [NC]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*simpleshare-buttons\.com [NC]
RewriteRule ^.* - [F,L]
</IfModule>
SetEnvIfNoCase Referer uptime-as.net spammer=yes
SetEnvIfNoCase Referer uptime-us.net spammer=yes
SetEnvIfNoCase Referer uptime-eu.net spammer=yes
SetEnvIfNoCase Referer hulfingtonpost.com spammer=yes
SetEnvIfNoCase Referer apanews.com spammer=yes
SetEnvIfNoCase Referer adcash.com spammer=yes
SetEnvIfNoCase Referer aliexpress.com spammer=yes
SetEnvIfNoCase Referer bestwebsitesawards.com spammer=yes
SetEnvIfNoCase Referer buttons-for-website.com spammer=yes
SetEnvIfNoCase Referer semalt.com spammer=yes
SetEnvIfNoCase Referer bycontext.com spammer=yes
SetEnvIfNoCase Referer cenokos.ru spammer=yes
SetEnvIfNoCase Referer cenoval.ru spammer=yes
SetEnvIfNoCase Referer cityadspix.ru spammer=yes
SetEnvIfNoCase Referer darodar.com spammer=yes
SetEnvIfNoCase Referer econom.co spammer=yes
SetEnvIfNoCase Referer edakgfvwql.ru spammer=yes
SetEnvIfNoCase Referer gobongo.info spammer=yes
SetEnvIfNoCase Referer ilovevitaly.com spammer=yes
SetEnvIfNoCase Referer ilovevitaly.org spammer=yes
SetEnvIfNoCase Referer ilovevitaly.info spammer=yes
SetEnvIfNoCase Referer ilovevitaly.ru spammer=yes
SetEnvIfNoCase Referer iskalko.ru spammer=yes
SetEnvIfNoCase Referer jollygame.net spammer=yes
SetEnvIfNoCase Referer luxup.ru spammer=yes
SetEnvIfNoCase Referer max-start.com spammer=yes
SetEnvIfNoCase Referer o-o-6-o-o.ru spammer=yes
SetEnvIfNoCase Referer o-o-8-o-o.ru spammer=yes
SetEnvIfNoCase Referer priceg.com spammer=yes
SetEnvIfNoCase Referer savetubevideo.com spammer=yes
SetEnvIfNoCase Referer screentoolkit.com spammer=yes
SetEnvIfNoCase Referer seoexperimenty.ru spammer=yes
SetEnvIfNoCase Referer slftsdybbg.ru spammer=yes
SetEnvIfNoCase Referer socialseet.ru spammer=yes
SetEnvIfNoCase Referer superiends.org spammer=yes
SetEnvIfNoCase Referer vodkoved.ru spammer=yes
SetEnvIfNoCase Referer websites-reviews.com spammer=yes
SetEnvIfNoCase Referer websocial.me spammer=yes
SetEnvIfNoCase Referer ykecwqlixx.ru spammer=yes
SetEnvIfNoCase Referer simpleshare-buttons.com spammer=yes
Order allow,deny
Allow from all
Deny from env=spammer
You can use this single combined rule with multiple OR
clauses:
RewriteEngine On
RewriteCond %{THE_REQUEST} \?(ref=.*)?\ HTTP [NC,OR]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*uptime-as\.net [NC,OR]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*uptime-us\.net [NC,OR]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*uptime-eu\.net [NC,OR]
RewriteCond %{HTTP_REFERER} ^https?://([^.]+\.)*hulfingtonpost\.com [NC]
RewriteRule ^ - [F,L]