Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an URL with special carachters (nicolòzanetti.com), and I'm having problem telling nginx how to handle it to the correct site.

With a basic configuration:
(the * in the urls is to tell stackexchange to stop bothering about them)
server_name www.nicolòzanetti.com nicolòzanetti.com; h*tps://www.nicolòzanetti.com -> Default virtual host but url unchanged h*tps://nicolòzanetti.com -> Default virtual host but url unchanged h*tp://www.nicolòzanetti.com -> Default virtual host and url changed to that of default virtual host h*tp://nicolòzanetti.com -> Default virtual host and url changed to that of default virtual host

So i tried with PunyCode:
server_name www.xn--nicolzanetti-rhb.com xn--nicolzanetti-rhb.com www.nicolòzanetti.com nicolòzanetti.com; h*tps://www.nicolòzanetti.com -> Works! h*tps://nicolòzanetti.com -> Works! h*tp://www.nicolòzanetti.com -> Default virtual host and url changed to that of default virtual host h*tp://nicolòzanetti.com -> Default virtual host and url changed to that of default virtual host

I even tried to use regex with ~^www.nicolòzanetti.com$ and ~^www.nicol.zanetti.com$, but it failed again. Both Nginx in the http declaration and PHP have been set to use utf8, I can't tell the same for perl (I don't even know if I should or how). I should use the nginx encode function? If yes where can I find some examples please? How else may I solve this?

share|improve this question

I did a whois for nicolòzanetti.com and get:

No match for "NICOLòZANETTI.COM".

I did a whois for nicolozanetti.com and get:

Whois Server: whois.instra.net
Referral URL: http://www.instra.com
Status: ok
Updated Date: 12-mar-2014
Creation Date: 12-mar-2014
Expiration Date: 12-mar-2015

Special characters are not allowed for .com. Forget the special character and you should be fine.

share|improve this answer
If what you say is true then why nicolòzanetti.com works? Why would onlydomains.com have allowed to sell me one? How it is that this other domain exists: mañana.com? What about: egalité.com? And btw, I also own nicolozanetti.com, and that is what you found, but it's out of topic. – Netscreever Mar 14 '14 at 10:02
Before I meant https, and manana and egalite http instead, SE removed it. – Netscreever Mar 14 '14 at 10:09
up vote 0 down vote accepted

I was testing it with Firefox.
http://nicolòzanetti.com was indeed redirecter to the default virtualhost.
What is funny, is that testing the same with Chrome instead works and I see the Nik page, instead of the wordpress installation.
So how it is that one browser gives me the correct result and Firefox doesn't?
Can anyone explain me the trick behind it? It's about how the browser encode the URL? Any was to enforce the correct encoding server side?

EDIT: I solved this at last, and the culprit was Firefox DNS that were set to last 2592000" (30 days). Flushing Firefox DNS solved the issue.
I actually use the following in nginx as server_name rule for www.nicolòzanetti.com and nicolòzanetti.com, while keeping also www.nicolozanetti.com and nicolozanetti.com for all the people that don't have "ò" in their keyboard.
This was tested with Firefox, Internet Explorer, Chrome and Opera (only the last one doesn't show "nicolòzanetti.com" but the punycode instead, however it works correctly).
server_name www.xn--nicolzanetti-rhb.com xn--nicolzanetti-rhb.com www.nicolòzanetti.com nicolòzanetti.com www.nicolozanetti.com nicolozanetti.com; This definitively proves "closetnoc" statement totally false, and I also feel it a little bit discriminatory, like "write 'murican urls worldwide or GTFO", but this is a personal feeling.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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