I have the following issue. I created this danish website flaatinfo.dk that is also accessible by flåtinfo.dk.
The domain manager gave me a certificate for flaatinfo.dk but said that they could not generate one for flåtinfo.dk because it contains a special character.
Is there a way (in nginx setup) that I can redirect all HTTPS requests from flåtinfo.dk to flaatinfo.dk??
HTTP redirects seem to work fine but if I try to redirect HTTPS like this I get cert error in browser:
server {
listen 443 ssl;
server_name flåtinfo.dk www.flåtinfo.dk;
return 301 https://flaatinfo.dk$request_uri;
}
CodePudding user response:
www.flåtinfo.dk
is an internationalized domain name (IDN).
According to NGINX documentation for internationalized names:
domain names (IDNs) should be specified using an ASCII (Punycode) representation in the
server_name
directive
So you should specify it in NGINX configuration as xn--fltinfo-fxa.dk
.
As for why your plain HTTP redirect worked anyway, it's probably because it didn't match any other domain so NGINX had to eventually choose it as default.
I get cert error in browser
Naturally, since you don't have a TLS certificate for your IDN, browsers will issue warnings. You need to get a TLS certificate for IDN to get rid of the warning. Let's Encrypt supports issuing certs for IDNs and is free of charge.
CodePudding user response:
Add redirect rule in .htaccess file present in root location