V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
fantasts
V2EX  ›  问与答

求解 nginx 重写规则

  •  
  •   fantasts · 2015-08-29 14:50:58 +08:00 · 2398 次点击
    这是一个创建于 3134 天前的主题,其中的信息可能已经有所发展或是发生改变。
    规则


    访问 URL


    并没有发生 URL 重写,改了几次规则都跟没生效一样。是不是我哪里格式错了。
    第 1 条附言  ·  2015-08-29 15:51:52 +08:00
    不好意思,是我理解错了。

    应该是访问
    域名 /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 条回复    2015-08-29 17:04:47 +08:00
    TangMonk
        1
    TangMonk  
       2015-08-29 14:52:30 +08:00
    图不错
    fundon
        2
    fundon  
       2015-08-29 15:07:15 +08:00
    `.` 需要转义吧
    tmqhliu
        3
    tmqhliu  
       2015-08-29 15:31:56 +08:00   ❤️ 1
    ^/images/ 根本匹配不上你访问的 URL ,怎么 rewrite
    建议好好学习 regex
    fantasts
        4
    fantasts  
    OP
       2015-08-29 15:42:40 +08:00
    @tmqhliu 不是前面是重写后面是匹配么?
    lhbc
        5
    lhbc  
       2015-08-29 15:46:11 +08:00
    你这 3 个(原 url 、 rewrite 后的 url 、你测试的 url ),完全风牛马不相及
    实在无力想象哪里错了
    tmqhliu
        6
    tmqhliu  
       2015-08-29 15:50:02 +08:00   ❤️ 1
    popok
        7
    popok  
       2015-08-29 15:53:16 +08:00   ❤️ 1
    @fantasts 是前面匹配,后面替换
    fantasts
        8
    fantasts  
    OP
       2015-08-29 16:00:54 +08:00
    @tmqhliu 是我理解错了,已解决
    fantasts
        9
    fantasts  
    OP
       2015-08-29 16:00:59 +08:00
    @popok 是我理解错了,已解决
    popok
        10
    popok  
       2015-08-29 16:05:43 +08:00   ❤️ 1
    fantasts
        11
    fantasts  
    OP
       2015-08-29 16:21:20 +08:00
    @popok 谢谢
    fantasts
        12
    fantasts  
    OP
       2015-08-29 16:59:03 +08:00
    @popok 请问下截图那个是工具还是在线网站呢?能分享下吗?
    popok
        13
    popok  
       2015-08-29 17:04:47 +08:00   ❤️ 1
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   949 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 21:25 · PVG 05:25 · LAX 14:25 · JFK 17:25
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.