P
P
pashaxp2013-07-26 14:01:21
Nginx
pashaxp, 2013-07-26 14:01:21

Nginx + rewrite individual links

There is a site configured on nginx+php-fpm. Let's call it example.com It is

necessary to do rewrites at the nginx level so that all requests are not
http://example.com/admin
redirected to a secure protocol.
https://example.com/admin

The remaining sections of the site should continue to work on regular http, only /admin redirects

. Any advice would be appreciated.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Burov, 2013-07-26
@pashaxp

location /admin {
   rewrite ^   https://example.com/admin permanent;
}

It?

A
avalak, 2013-07-26
@avalak

Rewrite is not needed.

location /admin {
    return 301 https://example.com/$request_uri;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question