php - NGINX rewrite one URL with parameter to another URL with new parameters -


i want redirect 1 specific url parameters 301 specific url new parameter.

https://www.example.com/index.php?id=329

to

https://www.example.com/index.php?eid=dd_googlesitemap

i tried think there several mistakes.

location = /index.php?id=329 {     rewrite ^ https://www.example.com/index.php?eid=dd_googlesitemap permanent; } 

or

location = /index.php {     if ($arg_id = "329") {         rewrite ^ https://www.example.com/index.php?eid=dd_googlesitemap permanent;     } } 

or

location = /index.php {     if ($args ~ "id=329") {         rewrite ^ https://www.example.com/index.php?eid=dd_googlesitemap permanent;     } } 

can help?

thanks!

the /index.php uri processed location ~ \.php$ block, , includes of necessary statements send filename php execution. if going create new location /index.php, need duplicate these statements also.

for example:

location = /index.php {     if ($arg_id = "329") {         return 301 /index.php?eid=dd_googlesitemap;     }     ... php statements ... } location ~ \.php$ {     ... php statements ... } 

alternatively, check uri before enters location block.

for example:

server {     ...     if ($request_uri = "/index.php?id=329") {         return 301 /index.php?eid=dd_googlesitemap;     }     ... } 

see this document more.


Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -