V
V
Vovanys2015-11-30 19:17:52
Nginx
Vovanys, 2015-11-30 19:17:52

How to format a regular expression in nginx?

Hello
There was a need to remove the output of the root controller.
There is a website site.ru and when you open it, the catalog controller opens. The URL does not change. But if you open site.ru/catalog there will be the same main page.
You need to make a redirect when opening such a page and so that site.ru/catalog redirects to the main one, but site.ru/catalog/product/bb does not redirect to the main one.
I tried that, but it didn't work...

location /catalog {
   return 301 http://site.net;
 }
location /catalog/ {
   return 301 http://site.net;
 }
location ^/catalog {
   return 301 http://site.net;
 }

If possible, poke into the Russian manual, with examples ..

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sunrails, 2015-11-30
@Vovanys

Well, what can you advise, except for nginx.org/en/docs/http/ngx_http_core_module.html#l...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question