将下面的链接地址:
1、情景一
https://testnewlearn.boowayun.com/ke/video/detail/13564.html
重定向到:
https://testnewlearn.boowayun.com/ke/video/13564.html?id=13564
Nginx中配置
说明:截取跳转地址中的特殊位置参数作为重定向路由参数
location /ke/video/detail {
if ($request_uri ~* ^(.*)video/detail/(.*).html$){
set $my_uri $2;
#rewrite (.*) $scheme://$host/ke/video/$my_uri?id=$my_uri;
rewrite (.*) https://testnewlearn.boowayun.com/ke/video/$my_uri?id=$my_uri;
}
}
2、情景二
https://learn.boowayun.com/ke/micro/play/11462.xhtml
重定向到:
https://learn.boowayun.com/ke/micro/play?courseId=11462
Nginx中配置
说明:截取跳转地址中的特殊位置参数作为重定向路由参数
if ($request_uri ~* ^(.*)/micro/play/(.*).xhtml$){
set $my_uri $2;
#rewrite (.*) $scheme://$host/ke/micro/play?courseId=$my_uri;
rewrite (.*) https://learn.boowayun.com/ke/micro/play?courseId=$my_uri;
}