Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.1k views
in Technique[技术] by (71.8m points)

怎么用nginx rewrite转发路径a.php到新的路径

由于历史原因 xxx/xxx/a.php?又臭又长的参数 这个地址不能更换

现在部分功能用了框架重写了 现在想转发a.php到框架写好的的实际处理脚本(不是跳转)

用了rewrite不行啊 换成a.html就可以。。。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

rewrite ^/xxx/xxx/a.php(.*)$ /index.php?s=$1 last;

(.*)$ 匹配的是a.php后面带的参数


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...