gpt4 book ai didi

redirect - Nginx 重定向仅更改域后 URL 的第一部分

转载 作者:行者123 更新时间:2023-12-05 08:43:14 27 4
gpt4 key购买 nike

我只想更改一组页面上 url 的第一部分。

例如。

domain.com/change/this/that/other 

domain.com/changed/this/that/other 

在这个例子中,包括这个在内的所有内容都是动态的

我觉得这行得通

location ~* ^/change/(.*)$ {rewrite ^ http://domain.com/changed/$1 permanent; break;}

但没有

最佳答案

正则表达式捕获变量与重写 block 本身有关。

location ~* ^/change/(.*)$ {
rewrite ^/change/(.*)$ http://example.com/changed/$1 permanent;
break;
}

你可以看到例子:http://nginx.org/en/docs/http/ngx_http_rewrite_module.html

关于redirect - Nginx 重定向仅更改域后 URL 的第一部分,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32462739/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com