How to implement Nginx case-insensitive directory-location redirection 301

后端 未结 2 1885
梦谈多话
梦谈多话 2020-12-17 22:19

I want to http://example.com/SomeThing redirect to http://example.com/something

something is nginx location (/s

2条回答
  •  佛祖请我去吃肉
    2020-12-17 23:14

    From nginx docs:

    A location can either be defined by a prefix string, or by a regular expression. Regular expressions are specified with the preceding “~*” modifier (for case-insensitive matching), or the “~” modifier (for case-sensitive matching).

    So ~* in location must be used for case insensitive matching.

    location ~* /something/ {
        # your code here
    }
    

提交回复
热议问题