Forum Moderators: phranque

Message Too Old, No Replies

Mod rewrite to ban site mirror spammer

         

wchan07

10:00 am on Mar 8, 2008 (gmt 0)

10+ Year Member



Hi all,

I have a problem with some jerk trying to mirror my site in a really sneaky and annoying way. This person bought my site name with a ".net" extension and actually put my ip address into his name server. now the search engines will see www.mysite.com and www.mysite.net with the exact same content on the same ip. This i think may get me banned on the search engines. There's not i can do about this. I am working to resolve this with my host but it is really annoying.

Is there a way to use .htaccess to block requests for ".net". I ideally would block the request, if not i guess redirect it.

this is what my .htaccess file looks like now:

SetEnvIfNoCase Referer "^http://www.mysite.com/" locally_linked=1
SetEnvIfNoCase Referer "^http://www.mysite.com$" locally_linked=1
SetEnvIfNoCase Referer "^http://mysite.com/" locally_linked=1
SetEnvIfNoCase Referer "^http://mysite.com$" locally_linked=1
SetEnvIfNoCase Referer "^$" locally_linked=1
<FilesMatch "\.(temp)$">
Order Allow,Deny
Allow from env=locally_linked
</FilesMatch>

RewriteEngine on

RewriteCond %{HTTP_HOST} !^(www\.)?mysite.com$ [NC]
RewriteRule ^(.*)$ [mysite.com...] [R,L]

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mysite.*$ [NC]
RewriteRule \.(exe¦zip¦wav¦wal)$ - [F]

#the rest of this file is just many RewriteRule

if after "RewriteEngine on" i add this will that do the trick?

RewriteCond %{HTTP_HOST} ^(www\.)?mysite\.(net¦org¦info¦biz¦us)$ [NC]
RewriteRule .* - [F]

jdMorgan

3:14 pm on Mar 8, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your first RewriteRule renders his ploy useless, except as a way to gather incoming links. He could gather links to his .net domain based on the quality and legitimacy of your .com site, and then change his DNS to point to his own site. So the scam here is not that he's fooling search engines, but rather that he may be fooling people into linking to him.

You can counter by keeping an eye on the backlinks to the .net variant, and then e-mailing the Webmasters linking to it, explaining the situation (be brief), and asking them to link to the "genuine" domain instead.

Alternately, you could add a page to your site explaining what's going on, and then mod_rewrite all .net page requests to that page:


RewriteCond %{HTTP_HOST} ^(www\.)?example\[b].net[/b] [NC]
RewriteRule \.(s?html?¦php)$ http://www.example.com/explain_spam_domain.html [R=301,L]

On that page, be sure to provide links to your own home page and site search facility, to avoid confusing legitimate visitors who found you through the bogus domain.

By the way, while modifying your existing code, I noticed an error in your code that *does* make what he's doing dangerous. Your domain redirect must be a 301, not the default 302, and should not be case-permissive. Use this instead:


RewriteCond %{HTTP_HOST} !^(www\.)?example\.com$
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

Note that you must change the broken pipe "¦" characters in the first code snippet above to solid pipes before use; Posting on this forum modifies the pipe characters.

Jim