Mobile app version of vmapp.org
Login or Join
Sherry384

: How to stop other domains to 301 redirect to my website domain? I found that someone is 301 redirecting his website domain to my website domain. fakedomain.com -> 301 redirects -> correctdomain.com

@Sherry384

Posted in: #301Redirect #Nginx #Redirects #Seo #Spam

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 fakedomain.com in the browser, then the other's domain DNS server redirects to 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

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Sherry384

1 Comments

Sorted by latest first Latest Oldest Best

 

@BetL925

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: 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;
}

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme