如何在Nginx中使用重写来转换Apacheredirect规则?

我需要一些帮助将.htaccess的Apache重写转换为Nginx。

我的WordPress网站有这个url结构:

https://domain.com/our-office/laos/ 

我需要改变:

 https://domain.com/laos/ 

我用Apache和.htaccess很容易地做到了这一点:

 Redirect 301 /our-office/laos /laos/ 

但是现在我转移到了Nginx,我无法得到相同的结果。

谢谢。

您可以使用“永久”关键字重写,例如:

 rewrite ^/our-office/laos/(.*)$ https://domain.com/laos/$1 permanent;