NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
ecosky
V2EX  ›  NGINX

请问如何设置 rewrite,才能使得 Nginx 二级目录如果是大写跳转为小写?

  •  
  •   ecosky · May 25, 2020 · 2311 views
    This topic created in 2227 days ago, the information mentioned may be changed or developed.
    现在有个场景需求,列如: https://www.test.com/TeSt/AA/BB 跳转为 https://www.test.com/test/AA/BB
    我这样操作不行,
    location /test {
    proxy_pass http://127.0.0.1:8080;
    }
    location ~* /test/ {
    rewrite .* /test/ last;
    }

    网上查询看都是直接用 lua 直接整个 url 都转为小写了,但我只需要这个二级目录转为小写,请问如何操作呢?
    1 replies    2020-06-01 15:00:34 +08:00
    rrfeng
        1
    rrfeng  
       Jun 1, 2020
    rewrite /TeST/(.*) /test/$1;
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   5331 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 40ms · UTC 03:48 · PVG 11:48 · LAX 20:48 · JFK 23:48
    ♥ Do have faith in what you're doing.