V
V
VirgiL2015-10-01 15:53:17
linux
VirgiL, 2015-10-01 15:53:17

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

1 answer(s)
A
AlexeyPortnov, 2015-10-01
@AlexeyPortnov

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 question

Ask a Question

731 491 924 answers to any question