G
G
galynsky2014-09-05 17:42:15
Nginx
galynsky, 2014-09-05 17:42:15

How to configure CNC in Nginx?

Good day to all. Tell me how to set up a redirect so that when site.ru/news goes news.html. I've tried so many things, nothing works. Thanks in advance.

location / {
        try_files $uri $uri/index.html $uri/ =404;
}

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vlad Zhivotnev, 2014-09-05
@inkvizitor68sl

If for one url, then:
location =/news {
rewrite ^/news$ news.html;
}

C
coder4web, 2014-09-05
@kinozol

It’s not entirely clear what the CNC and try_files have to do with it, a simple rewrite is enough for your request, inside the server {} block, before determining the locations
rewrite ^/news$ /news.html permanent;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question