fantasts
V2EX  ›  问与答

求解 nginx 重写规则

  •  
  •   fantasts · Aug 29, 2015 · 3036 views
    This topic created in 3996 days ago, the information mentioned may be changed or developed.
    规则


    访问 URL


    并没有发生 URL 重写,改了几次规则都跟没生效一样。是不是我哪里格式错了。
    Supplement 1  ·  Aug 29, 2015
    不好意思,是我理解错了。

    应该是访问
    域名 /images/330_930/域名 2/mw690/82c77094gw1evfca4l40yj21kw13w4ig.jpg
    重写到
    域名 /wp-content/themes/wpdx/timthumb.php?src=域名 2/mw690/82c77094gw1evfca4l40yj21kw13w4ig.jpg&h=330&w=930&zc=1
    13 replies    2015-08-29 17:04:47 +08:00
    TangMonk
        1
    TangMonk  
       Aug 29, 2015
    图不错
    fundon
        2
    fundon  
       Aug 29, 2015
    `.` 需要转义吧
    tmqhliu
        3
    tmqhliu  
       Aug 29, 2015   ❤️ 1
    ^/images/ 根本匹配不上你访问的 URL ,怎么 rewrite
    建议好好学习 regex
    fantasts
        4
    fantasts  
    OP
       Aug 29, 2015
    @tmqhliu 不是前面是重写后面是匹配么?
    lhbc
        5
    lhbc  
       Aug 29, 2015
    你这 3 个(原 url 、 rewrite 后的 url 、你测试的 url ),完全风牛马不相及
    实在无力想象哪里错了
    tmqhliu
        6
    tmqhliu  
       Aug 29, 2015   ❤️ 1
    popok
        7
    popok  
       Aug 29, 2015   ❤️ 1
    @fantasts 是前面匹配,后面替换
    fantasts
        8
    fantasts  
    OP
       Aug 29, 2015
    @tmqhliu 是我理解错了,已解决
    fantasts
        9
    fantasts  
    OP
       Aug 29, 2015
    @popok 是我理解错了,已解决
    popok
        10
    popok  
       Aug 29, 2015   ❤️ 1
    fantasts
        11
    fantasts  
    OP
       Aug 29, 2015
    @popok 谢谢
    fantasts
        12
    fantasts  
    OP
       Aug 29, 2015
    @popok 请问下截图那个是工具还是在线网站呢?能分享下吗?
    popok
        13
    popok  
       Aug 29, 2015   ❤️ 1
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2730 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 12:34 · PVG 20:34 · LAX 05:34 · JFK 08:34
    ♥ Do have faith in what you're doing.