Redirecting a specific URL to another in NGINX

I need to redirect a specific URL containing a parameter and binding to a new URL:

/pages/page.php3?page=fond_razeni_gk.htm#GKI 

to

 http://www.newserver.com/o-knihovne 

I'm trying to:

 rewrite ^/pages/page.php3\?page=fond_razeni_gk.htm$ http://www.newserver.com/o-knihovne? redirect; 

but it does not work. Could you advise me what is wrong?

+4
source share
1 answer

try this configuration:

 location / { rewrite ^/pages/page.php3(.*)$ http://www.newserver.com/o-knihovne$1 permanent; } 
+8
source

Source: https://habr.com/ru/post/1502246/


All Articles