【发布时间】:2021-01-10 01:36:01
【问题描述】:
当我几年前重新制作我的网站时,一些旧的散乱页面以旧格式留下。所以我在 htaccess 中编写了重定向以将它们发送到新页面。问题是旧网址在我不再使用的主要变量的末尾添加了一个字符。我将如何删除该字符,它是“r”还是“p”?这是我的重定向之一的示例。
RedirectMatch 301 /season-stats-regular-season-(.*)\.html https://www.lakerstats.com/season-stats/?seasonid=$1
所以它重定向页面:
https://www.lakerstats.com/season-stats-regular-season-5960r.html
到:
https://www.lakerstats.com/season-stats/?seasonid=5960r
问题是,我需要删除“r”,以便它转到:
https://www.lakerstats.com/season-stats/?seasonid=5960
我可以写什么来删除重定向代码中的“r”?正如我所说的,它也可以是一个“p”。
谢谢!
【问题讨论】:
-
试过了,重定向错误。
标签: regex .htaccess url redirect http-status-code-301