I want to redirect anything that comes directly to my server with perticuler query string to other location in same domain.
If user comes to
http://www.mydomain.com/?abc=js9sd70s
I want to redirect it to
http://www.mydomain.com/otherpath/?abc=js9sd70s
the query string ?abc=js9sd70s
should be the same to new url.
Please suggest nginx config file.
I have tried most of the alternative for below code. by keeping '\' before ? and = sign.
location ~ /?abc=.* {
rewrite ^/(.*)$ http://www.mydomain.com/otherpath/$1 permanent;
}
Please suggest me this location change.
Short answer, try this configuration:
location = / {
if ( $arg_abc ) {
rewrite ^ /otherpath/ permanent;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With