I want to redirect a string to different URL in nginx.
This what my vhost looks like and is working fine.
server {
listen 80;
server_name secure.example.com;
root /opt/tomcat/webapps/test/;
rewrite ^/Crest(.*)$ /$1;
location / {
proxy_pass http://127.0.0.1:8080/Crest;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
Now I just want to redirect http://secure.example.com/Crest?page=login to http://example.com
or /Crest?page=login to http://example.com
.