Answer the question
In order to leave comments, you need to log in
How to solve redirect problem in nginx?
Good afternoon.
There was such a problem, there are several rewrites in nginx, all of them are correctly processed except for one, which is given below:
rewrite ^/(.*)/page/$ site.ru/$1/page permanent;
rewrite page/ site.ru permanent;
the essence of this redirect is to redirect the site.ru/page page to site.ru, but at the same time do not touch links like site.ru/page1/page, which are also currently redirected to site.ru
Answer the question
In order to leave comments, you need to log in
rewrite /page/?$ /permanent;
means pages site.ru/page and site.ru/page/ redirect to /, do not touch the rest. Essence in $ - means the end of the line.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question