从 htaccess 中的重定向 URL 中删除字符

Removing a character from a redirect URL in htaccess

当我几年前重新做我的网站时,一些旧的散乱页面保留在旧格式中。所以我在 htaccess 中编写了重定向以将它们发送到新页面。问题是旧的 url 在我不再使用的主变量的末尾添加了一个字符。我将如何删除该字符,它是“r”还是“p”?这是我的重定向之一的示例。

RedirectMatch 301 /season-stats-regular-season-(.*)\.html https://www.lakerstats.com/season-stats/?seasonid=

因此它重定向了页面:

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”

谢谢!

您可以使用这条规则:

RedirectMatch 301 ^/season-stats-regular-season-(.+)r\.html$ /season-stats/?seasonid= 

确保在测试此更改之前清除浏览器缓存。