Forum Moderators: phranque
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]
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]
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]
Jim