NGINX rewrite rules, subdomain.domain.tld to domain.tld?

So, basically, my server technically is accessible at domain.tld, www.domain.tld, and subdomain.domain.tld, but I really want all web requests to be served from domain.tld. I've tried How to Create NGINX Rewrite Rules (the first section, simply using return) and my config test passes, but the rules aren't being followed. Any thoughts on some obvious conflict I'm missing, maybe about the order in which servers in config are loaded or something? Thanks.

2 Replies

This was either a matter of, indeed, the order in which I had things or some sort of Safari caching messing with me, because it started working, of course, not long after I posted this.

Any of that could have contributed to this.

It's also possible that the DNS just hadn't completely propagated yet. It's a rule of thumb that it can take up to 48 hours for it do so, even though I've only seen it take that long on rare occasions.

I'm glad that it's working for you. If you run into any other issues with this, let us know. You can post about it here, or even open a Support ticket if you want to discuss account-specifics.

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct