V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
mechille
V2EX  ›  NGINX

nginx正则匹配的问题

  •  
  •   mechille · 2013-03-28 16:31:56 +08:00 · 2568 次点击
    这是一个创建于 4055 天前的主题,其中的信息可能已经有所发展或是发生改变。
    location / {
    index index.html index.htm index.php;
    rewrite ^/(.*)$ /index.php?/$1;
    }

    配置文件的正则部分如上,但是诸如.css和.jpg结尾的文件也被rewrite了,请问怎么屏蔽
    2 条回复    1970-01-01 08:00:00 +08:00
    twm
        1
    twm  
       2013-03-28 16:35:40 +08:00   ❤️ 1
    if (!-e $request_filename) {
    rewrite ^/(.+)$ /index.php?$1 last;
    }
    mechille
        2
    mechille  
    OP
       2013-03-28 16:49:57 +08:00
    @twm 感谢已发送
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2215 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 430ms · UTC 02:09 · PVG 10:09 · LAX 19:09 · JFK 22:09
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.