Question

There is a malicious site which has replaced mine in Google search results. I checked the headers and this malicious domain is sending traffic directly to our servers.

I'd like to rewrite Apache's directives so that there is a 301 redirecting any traffic from the malicious site to our site in order to get Google to give me back my listing.

Does anyone know how to write this directive? I hardly know anything about this stuff but I think it involves RewriteEngine. Do I update it in .htaccess?

UPDATE FOR CLARITY: When someone searches for my company name in Google the malicious domain is the top result. Click on it and it immediately goes directly to our server - it's not a redirect, it's a straight 200 to my IP (but in their domain). Makes me think they're pointing their DNS to my IP. Is there a way to write a directive that would execute a 301 redirect to my domain whenever traffic was coming from the malicious domain?

RESOLVED: I had help figuring this out... here's the fix. I put this at the top of my {site.com}.conf file:

<VirtualHost *:80>
      RedirectMatch permanent ^/(.*) http://www.{site}.com/$1
</VirtualHost>
Was it helpful?

Solution 2

I had help figuring this out... here's the fix. I put this at the top of my {site.com}.conf file:

<VirtualHost *:80>
   RedirectMatch permanent ^/(.*) http://www.{site}.com/$1
</VirtualHost>

OTHER TIPS

You say this:

I checked the headers and this malicious domain is sending traffic directly to our servers.

Then this:

I'd like to rewrite Apache's directives so that there is a 301 redirecting any traffic from the malicious site to our site in order to get Google to give me back my listing.

So it’s already sending traffic to your servers but you want to do what exactly? Apache rewrite rules only work on servers you have control of. If someone poisoned your listings on Google & now gets traffic, your access to your own servers won’t change that.

test the host header and redirect.

RewriteEngine on
RewriteCond %{HTTP_HOST} !^(www\.)?yourhost.com$
RewriteRule . http://www.yourhost.com%{REQUEST_URI} [R=301]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top