Answer the question
In order to leave comments, you need to log in
How to properly set up a redirect in nginx?
Hello.
There is a url
/souvernirs-for-tourists/ELEMENT_CODE/
I need all urls for this section (souvernirs-for-tourists) to look like this
/souvernirs/ELEMENT_CODE/
How to do it?
And why doesn't it work like this?
location /catalog {
rewrite ^/catalog/souvernirs-for-tourists/(.*)$ http://SITE-NAME/suveniry/$1 permanent;
}
Answer the question
In order to leave comments, you need to log in
It worked like this
location ~* /catalog/souvernirs-dlya-tourists/ {
rewrite ^/catalog/souvernirs-dlya-tourists(.*)$ /catalog/suveniry$1 permanent;
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question