Nginx: how to redirect all request from https://domainA.com to https://domainB.com? (and not only http ones)
I have several domain names, and I want redirect all of them to https://indi-ticket.fr
I have configured Nginx and all the request from http://other-domain.xx are redirected to htpps://indi-ticket.fr but not these from https://other-domain.xx.
Here is the relevant part of my Nginx conf:
server {
listen 80;
server_name
www.indi-ticket.fr
indi-ticket.fr
www.indi-tickets.fr
indi-tickets.fr
www.indi-ticket.com
indi-ticket.com;
return 301 https://indi-ticket.fr$request_uri;
}
server {
listen 443 ssl;
server_name indi-ticket.fr;
ssl on;
...
What is wrong with this conf? What curl -I -L https://indi-tickets.fr
does not redirect to https://indi-ticket.fr
?
Answer
https://indi-tickets.fr is using HTTPS, which means it's hitting port 443, not port 80. Your port 443 config doesn't do any redirecting. It's possible to have a combined server block that handles both.
Comments
Post a Comment