Answer the question
In order to leave comments, you need to log in
Location in nginx and regex followed by redirect?
There is such a config.
location ~ /give_me/(.*)$ {
return 301 http://site.com/page/$1;
}
location ~ ^/page/(.*)$ {
proxy_pass http://site.com/$1;
}
Answer the question
In order to leave comments, you need to log in
rewrite ^/give_me/(.+)$ /page/$1 permanent;
location ~ ^/page/(.*)$ {
proxy_pass http://site.com/$1;
}
And even better like this:
location /give_me/ {
rewrite ^/give_me/(.+)$ /page/$1 permanent;
}
location /page/ {
proxy_pass http://site.com/;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question