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

How to exclude a directory with nginx rewrite redirection?

WBOY
Release: 2016-08-29 08:50:51
Original
3250 people have browsed it

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>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template