V
V
Vadim Bakhtin2016-06-04 13:21:32
Nginx
Vadim Bakhtin, 2016-06-04 13:21:32

How to redirect all requests to one nginx file?

Hello, earlier on apache, I had all requests to the site redirected to one php file, and from there this script already decided which page to render based on the URL, so how to make absolutely all requests go to one file on nginx?
But not including requests that go to ajax, css, img, resources directories and robots.txt + sitemap.xml files in the main directory.
That is, if there is a request for /news or /news/1.png, everything processes one main file, but if there is a request for /img/1.png or /css/main.css, then this file must be opened.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Kalibrov, 2016-06-04
@from2003

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

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question