V
V
Viktor Dotsenko2016-10-04 14:56:40
Nginx
Viktor Dotsenko, 2016-10-04 14:56:40

What is the best way to set up a redirect from www to non-www on nginx?

Good afternoon experts.
Can you please tell me how to set up a redirect from www to non-www in nginx? The problem is that there is a www.origitea.ru domain that needs to be done on without www, because an SSL certificate is issued only for without www, because of this problem Yasha and Google highlights as not safe.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
falsebyte, 2016-10-04
@falsebyte

try adding something like this:

server {
        listen       80;
        server_name www.origitea.ru origitea.ru;
        return 301 https://origitea.ru$request_uri;
}

Well, then your main config
server {
        listen       443;
        server_name origitea.ru;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question