Site being served on third party domain, stealing rankings



My Discourse forum is being sub-domained by a random third party domain / hosting provider.

That subdomain loads my Discourse forum but I have no idea what that domain is to begin with. How can I prevent this from happening in the future?

Title links only work if the slug is present
Old domain stealing google ranking
(Jeff Atwood) #2

What? You do not own that domain name? I don’t understand.



I don’t own that domain at all - but when I searched my site on Google to see if I was indexing properly, that site showed up instead. I have no affiliation to that site but that specific subdomain loads my site.

(Allen - Watchman Monitoring) #4

Maybe that site used to be on a server which had your IP, then it was recycled and you got it from Digital Ocean.

Getting OttawaTeams to fix their DNS, or getting a new IP from DO should fix it.


That’s probably what happened. Getting a new IP is pretty bad web technique don’t you think?

(Allen - Watchman Monitoring) #6

I’d do whatever took me less time.

Maybe the IT admin at is super friendly and just as glad to remove the stale A record from their dns zone?

(Sam Saffron) #8

You could set up nginx to demand host matches, that way only your domain will work

I may add a site setting / option for something like this


That would be great because they are stealing my Google rankings.

Also, how do I set up the nginx temporarily?

(Logan Mathews) #10

server {
return 301$request_uri;

The above will redirect everything to your domain and solve your SEO issues.



What file do I place that in?

(Sam Saffron) #12

Just wait, will add a site setting for this, maybe even default on for non-multisite.

(Felix Freiberger) #13

If you do this, can you please still allow direct access by IP? Having this has been nice sometimes, e.g. for quick test installs or while waiting for DNS to propagate.


Thanks for doing this! I appreciate it.

(Erik Manger) #15


When is the feature going to be released?

(Matt Palmer) #16

Hey @Erik_Manger, this fell between the cracks of getting the 1.4 release out the door. Sam has handed this off to me. I expect to have something ready for public consumption in a couple of weeks.

(Sam Saffron) #17

Technically I think the best thing to do here is just add a new ENV setting or param into our templates.

If force_hostname is true then force it using NGINX with an extra redirect rule for direct ip access.

(Matt Palmer) #18

That was one way I considered. Another, more flexible, way would be to have a site setting that specified a “domain whitelist” regex, and have a teeny middleware that checked the Host header against that site setting, and returned a 404 if it didn’t match.

I’ve started an implementation of the latter method, which I’m now going to exercise with extreme vigour. If you’d prefer the nginx-based way, @sam (or anyone else), speak now and I can easily switch to that approach.

(Sam Saffron) #19

I think NGINX is fine for now, would prefer less work done in the rails stack

(Matt Palmer) #20

Well, the nice thing about my approach is that it isn’t done in Rails, it’s done before the app, in a teeny tiny middleware. Also, based on some of the things we talked about last week, I thought it would be better if we don’t add more things that require rebuilding the docker image to change unless we absolutely have to.

(Jeff Atwood) #21

I would say this is a case where a rebuild would be expected though. As in “let me define the name of my site”, defining what the name is not is also strongly implied.