Using nginx 1.8.1 on CentOS Linux, I am attempting to do the following:
- Redirect traffic from
server_name server1.olddomain.com;toserver2.newdomain.com - In doing so, remove
sitesfrom the path.
For example, a modified snippet from nginx.conf.
server {
...
server_name server1.olddomain.com;
...
location /sites/ITDept {
rewrite ^(.*) https://server2.newdomain.com/ITDept;
}
While this does work as expected for the exact rule above, anything else does not work.
https://server1.olddomain.com/sites/ITDept/subfolder/subfolder does not redirect as desired as https://server2.newdomain.com/ITDept/subfolder/subfolder. It redirects to https://server2.newdomain.com/sites/ITDept/subfolder/subfolder.
I've spent hours trying to figure out the correct syntax without success. I hope that there is someone that can be of assistance. Thank you in advance.