location / {
#rewrite_log on;
#error_log /usr/local/etc/nginx/logs/gs.me.rewrite.error.log notice;
# 登录转发
rewrite ^/a-(\d+).html?(\w+) /open.php?m=a&$2 last;
rewrite ^/b-(\d+).html?(\w+) /open.php?m=b&$2 last;
rewrite ^/c-(\d+).html?(\w+) /open.php?m=c&$2 last;
# 游戏转发
rewrite ^/(\d+)/play/(\d+).html?(\w+) /d.php?m=play&fromUid=$4&$5 last;
rewrite ^/play-(\d+)-(\d+).html?(\w+) /d.php?m=play&fromUid=$2&$3 last;
rewrite ^/play_(\d+)_(\d+).html?(\w+) /d.php?m=play&fromUid=$2&$3 last;
# 其它
rewrite ^/other-(\d+).html?(\w+) /e.php?$2 last;
}
Nginx服务器下使用rewrite重写url以实现伪静态的示例:https://www.jb51.net/article/76059.htm
nginx rewrite 指令和规则:https://blog.csdn.net/feng27156/article/details/39010131
0 条评论。