Nginx:将文件夹重写到folder2

我需要做一个简单的重写,并不能找出如何。

将“ http://example.com/”index.php / administrator / catalog_product / new /“dumpidum”改写为“ http://example.com/”index.php / administrator / catalog_product / new / set / 4 / type /简单/ “dumpidum”

我发现的是:

rewrite /index\.php/administrator/catalog_product/new/(.*)$ /index.php/administrator/catalog_product/new/set/4/type/simple/$1; 

但是这并不像预期的那样工作。

注意:apache2代码将是:

 Redirect 302 /index.php/administrator/catalog_product/new/key/ http://example.com/index.php/administrator/catalog_product/new/set/4/type/simple/key/ 

有人看到我做错了吗? 我非常想知道

您要求重写,但您的Apache示例是redirect。 除非你另外指定,否则nginx会对相对path进行重写。 您需要指定rewrite指令redirect标志为了发送redirect。

 rewrite ^/index\.php/administrator/catalog_product/new/(.*)$ /index.php/administrator/catalog_product/new/set/4/type/simple/$1 redirect;