Reputation: 61
I am trying to redirect http://example.com/test/index.php?/Server/Search/IP_ADDRESS to http://example.com/?ip=IP_ADDRESS
Tried following rewrite rule, but, it is not working.
rewrite ^/test/index.php?/Server/Search/(.*)$ http://example.com/?ip=$1 redirect;
This is needed for internal purpose as another api will check the IP address at http://example.com/?ip=IP_ADDRESS
Upvotes: 0
Views: 58
Reputation: 4455
location = /test/index.php {
if ($args ~ "^/Server/Search/(.+)") {
set $sip $1;
rewrite ^(.*)$ /?ip=$sip? redirect;
}
}
Upvotes: 2