We help IT Professionals succeed at work.

htaccess to block a referrer

ddantes
ddantes asked
on
I am trying to block a specified domain from my website, and haven't been successful.   The visits are coming from this URL:
best-seo-solution.com/try.php?u=http://mauivacationrental.com

mauivacationrental.com is one of my domains, and visitors are redirected to my other domain (www.mauitradewinds.com) using .htaccess.   The .htaccess which resides in the root folder of mauivacationrental.com is attached.  Please advise.

htaccess.txt
Comment
Watch Question

Commented:
First of all, your:
RewriteEngine On
RewriteBase /

statements should be placed BEFORE the rewrite conditions.

You are also missing the second [NC,OR]

Try this:
#Block traffic from "bad" referrers
RewriteEngine On
RewriteBase /

RewriteCond %{HTTP_REFERER} make-money-online.7makemoneyonline.com [NC,OR]
RewriteCond %{HTTP_REFERER} 245.semalt.com [NC,OR]
RewriteCond %{HTTP_REFERER} best-seo-solution.com
RewriteRule .* - [F]

# redirect entire site to Site-1
RewriteRule ^(.*)$ http://www.mauitradewinds.com [R=301,L]

Open in new window

Author

Commented:
Thanks!