Home  >  Article  >  Backend Development  >  How to exclude a directory with nginx rewrite redirection?

How to exclude a directory with nginx rewrite redirection?

WBOY
WBOYOriginal
2016-08-29 08:50:513190browse

codingoniter configure nginx as follows:

if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}

After configuration, all unused directory files are redirected to index.php
The css js images in the resource folder of the root directory cannot be accessed and 404 is displayed.
How can I prevent the resource directory from being redirected? ? ?

Reply content:

codingoniter configure nginx as follows:

if (!-e $request_filename) {
rewrite ^.*$ /index.php last;
}

After configuration, all unused directory files are redirected to index.php
The css js images in the resource folder of the root directory cannot be accessed and 404 is displayed.
How can I prevent the resource directory from being redirected? ? ?

<code>tryfiles $uri $uri/ /index.php;</code>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn