简体   繁体   English

重写URL nginx删除连字符

[英]Rewrite URL nginx remove hyphen

I am using this rewrite rule to redirect http://example.com/abc?id=learn-more to 我正在使用此重写规则将http://example.com/abc?id=learn-more重定向到

http://example.com/abc?id=learnmore http://example.com/abc?id=learnmore

rewrite ^/a-b-c?id=learn-More http://example.com/abc?id=learnMore permanent

But its not working !! 但是它不起作用! It does redirect to 它确实重定向到

http://example.com/abc?id=learn-more (learn-more is not converted to learnmore). http://example.com/abc?id=learn-more(“learn-more”不会转换为“ learnmore”)。

How to achieve this? 如何实现呢?

location = /a-b-c {
    if ($arg_id = learn-More) {
        return 301 /abc?id=learnMore;
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM