Home  >  Article  >  Backend Development  >  nginx rewrite 重定向有关问题

nginx rewrite 重定向有关问题

WBOY
WBOYOriginal
2016-06-13 12:08:12899browse

nginx rewrite 重定向问题?
https://www.123.com/770422332/index.php    =>    http://www.123.com/index.php?id=770422332

我想怎么变化该怎么写rewrite

location / {
     rewrite ^/(/d+)\/index\.php$ /index.php?id=$1 last;
}

我怎么写不行~不知道错在哪里~帮忙看下谢谢~!
------解决思路----------------------
https://www.123.com/770422332/index.php
你这个是啥规则啊?
https://www.123.com/index/770422332
=>
 rewrite ^/index\/(/d+)$ /index.php?id=$1 last;
------解决思路----------------------

<br /><br />rewrite "^/(/d+)/index.php$" /index.php?id=$1 last;<br /><br />

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn