Scripteen
Elite Member
- Sep 19, 2009
- 1,818
- 1,930
I had an incident where someone was redirecting few banned domains to my website (talk negative seo) so I made a short list of these bad domains and blocked them from pointing to my server but the guy added few more domains so I needed a more practical solution and after research and try and error I came up with the following code that you should put in your .htaccess file.
The first part of the code redirects non www to www then the 2nd one filters any traffic coming from any domain other than yours to google.com or you can change google.com to any other domain you want and send garbage traffic to it. This gives some kind of protection layer to one of the methods used by negative SEO.
Code:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^mydomain.com
RewriteRule (.*) http://www.mydomain.com/$1 [R=301,L]
RewriteEngine on
RewriteCond %{HTTP_HOST} !=www.mydomain.com
RewriteRule .* http://www.google.com [R=301,L]
The first part of the code redirects non www to www then the 2nd one filters any traffic coming from any domain other than yours to google.com or you can change google.com to any other domain you want and send garbage traffic to it. This gives some kind of protection layer to one of the methods used by negative SEO.