当前位置:首页 > 服务器技术 > nginx

nginxrewrite重定向怎么排除一个目录?

codeingoniter 配置nginx如下:

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

配置后所有没有的目录文件 都被重定向到index.php
根目录的resource文件夹内的css js 图片 都访问不了了 显示404
请问如何使resource目录不被重定向???

回复内容:

codeingoniter 配置nginx如下:

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

配置后所有没有的目录文件 都被重定向到index.php
根目录的resource文件夹内的css js 图片 都访问不了了 显示404
请问如何使resource目录不被重定向???

tryfiles $uri $uri/ /index.php;

【说明】本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:254677821)!