YAFEIML
V2EX  ›  问与答

求个 nginx 伪静态规则

  •  
  •   YAFEIML · Dec 25, 2014 · 2382 views
    This topic created in 4318 days ago, the information mentioned may be changed or developed.
    2 replies  •  2014-12-25 22:27:50 +08:00
    yrdr
        1
    yrdr  
       Dec 25, 2014
    Location ~ \.torrent$ {
    if (!-e $request_filename) {
    rewrite ^/download/((?!\.torrent)[\w_\.]+)\.torrent$ /download.php?filename=$1&fileurl=http://www.xxx.com/asdasdsadasd.torrent last;
    }
    }
    你这里写得很不明白,asdasdsadasd.torrent明明应该是真正的文件啊?你除非是在数据库里面写好对应的路由,否则怎么可能达到你要的要求?
    P.S 以上规则只是凭经验写的,未经过测试,错了也别喷
    YAFEIML
        2
    YAFEIML  
    OP
       Dec 25, 2014
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1190 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 18:00 · PVG 02:00 · LAX 11:00 · JFK 14:00
    ♥ Do have faith in what you're doing.