我想将文件名重写membership-list.html
为根域上的目录membership-list/
。我的配置文件中有以下内容:
location = ^/membership-list.html {
rewrite ^/membership-list.html ^/membership-list/ redirect;
}
我四处搜索,找不到任何有关从文件重定向到目录名的信息。
答案1
将其放在位置块外面和服务器块里面。
rewrite ^/membership-list.html /membership/;
然后根据你的需要创建位置:
location /membership/ { }
https://www.nginx.com/blog/creating-nginx-rewrite-rules/
http://www.imrantariq.com/blog/regular-expression-caret-or-circumflex-in-character-class/