2

I found that someone is 301 redirecting his website domain to my website domain.

fakedomain.com -> 301 redirects -> correctdomain.com

Using the contact information found by whois query, I already contacted, the owner of fakedomain.com telling him to remove the 301 redirect, but I got no answer...

So I am thinking to solve this by my own: since on my server I am using nginx web server: there is any way to block or prevent this from happening?

And what are the consequences of that redirect from a SEO point of view?

Note:

when an user type www.fakedomain.com in the browser, then the other's domain DNS server redirects to www.mydomain.com and in the HTTP Header response there isn't any referer set. To better explain here are the HTTP headers from a request made on Chrome browser:

General
Request URL:http://www.fakedomain.com/
Request Method:GET
Status Code:301 Moved Permanently
Remote Address:46.101.241.137:80

Response Headers
Connection:keep-alive
Content-Length:185
Content-Type:text/html
Date:Wed, 28 Dec 2016 00:30:41 GMT
Location:http://www.correctdomain.com/
Server:nginx/1.10.2

Request Headers
Accept:text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,/;q=0.8
Accept-Encoding:gzip, deflate, sdch
Accept-Language:it-IT,it;q=0.8,en-US;q=0.6,en;q=0.4
Connection:keep-alive
Host:www.fakedomain.com
Upgrade-Insecure-Requests:1
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36

  • You should be able to key off of fakedomain.com being the referrer and then reject the request with a 403 response, 404, or redirecting to some nasty site such as "the view" (the t.v. show web site - humor - you could use jerry springer too). I do not know how to do this with nginx, however, it should be easily done. – closetnoc Dec 22 '16 at 0:13
  • This is likely a domain monetizer that is using your site to increase the value of their site. This is a fairly common trick, albeit rather ineffective, and will be terminated at some point. I would not wait too long. What the effect on your domain would be can vary, however, you do want to stop this dead in it's tracks as soon as you can if for no other reason than it is the right thing to do. If it takes you a few days or a week to figure this out, that should be okay. Just do not let these ****** (insert favorite expletive here) get away with their silliness for very long. Cheers!! – closetnoc Dec 22 '16 at 0:19
  • I wrote a rule on $http_refer to catch to reject the request with 404. But it still doesn't work on browsers, instead it work when I use curl --referer – mgambella Dec 22 '16 at 0:36
  • Domain monetizer I understand... What can I do to stop this? – mgambella Dec 22 '16 at 0:38
  • If it works with curl, I would think that would be correct code. Not sure why it does not work with browsers. You are doing the right thing. You just want all of the requests from that domain to fail one way or another. A 404 is good. If you want to really have fun, then you can get creative of course. You could always redirect back to the fake domain... I am a stinker! Check your log files to see if your code works. It should be fairly clear. Cheers!! – closetnoc Dec 22 '16 at 0:48
1

The idea to redirect requests back isn't good, because it could produce redirect loops. Instead return better an error for visitors with referer of domain you want block.

The scenario will work like:

  • aliendomain.com links to your site.
  • Somebody clicks on this link intending to visit your site,
  • Your server recognizes, that this visitor comes from the site, you don't want visitors from
  • and answers with an error.

Following variants should do the job:

location = /index.html {
if ($http_referer ~* (www.)?alienadomain.com) {
return 403;
}
}

to do so youl'll maybe need this one: http://nginx.org/en/docs/http/ngx_http_referer_module.html . I'm not sure, where this module is a part of default package.

or so:

if ($http_referer ~ "((www.)?alienadomain\.com)") {
set $prohibited "1";
}

if ($prohibited) {
return 403;
}

Or even using map, like this

map $http_referer $bad_referer {
default                  0;
"~alienadomain.com"      1;
}

if ($bad_referer) {
return 403;
}

Or, using multiple keywords:

if ($http_referer ~* (aliendomain|another_aliendomain)) {
return 403;
}
  • Thank you, for you answer, this is what I would like to achieve, but this solution only works when using $ curl -I --referer http://alienadomain.com http://example.com – mgambella Dec 27 '16 at 22:57
  • Instead when I access alienadomain.com from the browser then it redirects me to mywesite.com as usual... – mgambella Dec 27 '16 at 23:01
  • @mgambella read my edit – Evgeniy Dec 28 '16 at 0:02
  • I edited my question, please read it: it seems that when the other DNS server responds with a 301 redirect then there isn't set a referer to catch. – mgambella Dec 28 '16 at 0:48
  • 1
    "aliendomain.com links to your site." - However, this does not appear to be the scenario the OP is describing. aliendomain.com "301 redirects" to the OPs site, it doesn't contain a "link" (HTML anchor) to the OPs site. Consequently, whatever HTTP Referer is sent in the request from the users browser is dependent on wherever the link did originate. But from the question, we don't know where the link originated. – MrWhite Dec 28 '16 at 1:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.