I can't seem to find a simple answer to this question as all redirect/rewrite examples are always trying to do so much more than what I want to do:
I have a server block where server\_name is a wildcard:
server\_name \*.example.com;
All I want to do is redirect [sub1.example.com](https://sub1.example.com) to [sub2.example.com](https://sub2.example.com).
How would I write this redirect/rewrite?
An easy way is to create another server block just for sub1. A more specific server_name will match.
server {
server_name sub1.example.com;
listen 80;
# add ssl stuff if necessary
rewrite ^ https://sub2.example.com$request_uri permanent;
}