gpt4 book ai didi

redirect - 301重定向目录匹配

转载 作者:塔克拉玛干 更新时间:2023-11-03 02:43:33 24 4
gpt4 key购买 nike

我一直无法得到这个问题的答案。基本上,我有一堆网址,它们是这样的:

  • www.mysite.com/gb/best-price/description.shtml
  • www.mysite.com/fr/best-price/description.shtml
  • www.mysite.com/jp/best-price/description.shtml

我需要将他们重定向到他们的直接匹配页面,如下所示:

  • www.mysite.com/gb/best-price/index.shtml
  • www.mysite.com/fr/best-price/index.shtml
  • www.mysite.com/jp/best-price/index.shtml

我知道我可以做一对一的重定向,但事实是,我有数百个这样的 url.. 如何让重定向与目标 url 批量匹配,而不做一对一的重定向1?例如,/gb/best-price/description.shtml 到/gb/best-price/index.shtml

基本上,gb 到 gb,fr 到 fr,jp 到 jp。新旧 url 的唯一区别是 html 文件名(原始 url 以 description.shtml 结尾,新 url 以 index.shtml 结尾)。

谢谢,亚历克斯

最佳答案

你可以尝试:

location / {
rewrite ^/(.*)/best-price/description.shtml ^//1/best-price/index.shtml permanent;

我认为它可以帮助你。 !!

关于redirect - 301重定向目录匹配,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37249189/

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