K
K
KRHD2021-01-18 11:50:21
Nginx
KRHD, 2021-01-18 11:50:21

How to redirect everything but the main page with NGINX?

There is domen.ru - it should lead to the one/index.html
folder Ecnm domen.ru/{any route} - it should lead to the two/index.html folder
Tell me how to do this, I've been tormented all day

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Lynn "Coffee Man", 2021-01-18
@KRHD

Something like this:

root /two;

location = / {
    root /one;
    rewrite ^ /index.html break;
}

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

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question