Redirect nginx将旧URL重定向到新URL

Redirect nginx将旧URL重定向到新URL,redirect,nginx,rewrite,url-redirection,Redirect,Nginx,Rewrite,Url Redirection,我们刚刚将所有的产品url更新为新的url。它只在URL中添加一些字母。 一个例子 旧网址: http://www.example.com/parent/children/product.html 新网址: http://www.example.com/new-parent/children/product.html (刚刚在“家长”中添加了“新建”) 我试着用这个,但没用 location /parent { rewrite ^/parent(.*) http://$server_

我们刚刚将所有的产品url更新为新的url。它只在URL中添加一些字母。 一个例子

旧网址:

http://www.example.com/parent/children/product.html
新网址:

http://www.example.com/new-parent/children/product.html
(刚刚在“家长”中添加了“新建”)

我试着用这个,但没用

location /parent {
    rewrite ^/parent(.*) http://$server_name/new-parent$1 permanent;
}

有人能帮我纠正这个重定向吗?

试着把
重写^/parent(.*)http://$server\u name/新的parent$1永久进入
服务器
指令,而不是进入
/parent
位置。

对问题的描述不正确。你应该描述发生了什么。还显示完整服务器配置Hi-Alexey。我的意思是旧的URL并没有重定向到新的URL,谢谢“显示完整配置”这个词不清楚?很高兴它有帮助。请把答案标为正确答案。