A
A
Aidar Khayatov2018-12-26 15:19:45
Nginx
Aidar Khayatov, 2018-12-26 15:19:45

How to properly configure routing in nginx?

Good afternoon! There is a block in the nginx configuration file for transferring requests to the 1.0 folder to the index file in it.
location /1.0/ {
try_files $uri $uri/ /1.0/index.php?$query_string;
}
On the request localhost/1.0/user/5/params - $_SERVER[REQUEST_URI] returns /1.0/user/5/params
Is it possible to somehow register in nginx that it should return /1.0/ without the folder?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladislav Lyskov, 2018-12-26
@Haiatov

location / {
        rewrite ^/(.*)$ /1.0/index.php last;
    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question