Reputation: 1534
For example I need to redirect urls that match this pattern and keep the rest.
aaa.mydomain.com/path/1/listing
to
bbb.somedomain.com/path/1/listing
The "1" in that path can be any integer and needs to go to the correct redirect. Can this be done with a location block or do i need rewrite?
Upvotes: 1
Views: 2431
Reputation: 14259
You can do it like this
server {
server_name aaa.mydomain.com;
return 301 //bbb.somedomain.com$request_uri;
}
Well, then use something like this
location ~ /path/[^/]+/listing$ {
return 301 https://bbb.somedomain.com$request_uri;
}
Upvotes: 1