Answer the question
In order to leave comments, you need to log in
NGINX Redirect How to implement?
Good evening, I'm interested in advice on the correct nginx configuration settings for the following situation:
there are (www.)domain1.local, (www.)domain2.local - 4 domains, including www
, all possible variations
domain1.local > https://domain2.local
https ://www.domain1.local > https://domain2.local
domain2.local > https://domain2.local
How to implement a technically correct and correct 301 redirect for merging an old domain with a new one. We get a working domain https://domain2.local , all other variations redirect to it..
There are a large number of examples, but still, which one is the best in your opinion?
Answer the question
In order to leave comments, you need to log in
server {
listen 80, 443;
server_name domain1.local, www.domain1.local;
rewrite https://domain2.local permanent;
}
server {
listen 80; # для понимания
server_name domain2.local, www.domain2.local;
rewrite https://domain2.local permanent;
}
server {
listen 443;
server_name domain2.local;
....
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question