大多数 301 重定向转到同一个错误页面

most 301 redirect going to the same wrong page

提问人:John2 提问时间:10/17/2023 更新时间:10/17/2023 访问量:12

问:

我正在将一个站点移动到另一个站点。我已经设置了单独的重定向。但是所有页面都转到“主页”页面,而不是目标页面。这些目标页面是有效的。这是怎么回事?

原始基本 url https://www.ojolie.com

以下是一些示例。

RedirectMatch 301 /cards/corporate https://corporate.ojolie.com/home  
RedirectMatch 301 /cards/corporate/contactus https://corporate.ojolie.com/contact_us 
RedirectMatch 301 /cards/corporate/faq https://corporate.ojolie.com/faq  
RedirectMatch 301 /cards/corporate/viewcard/506 https://corporate.ojolie.com/card/peace--joy
RedirectMatch 301 /cards/corporate/viewcard/507 https://corporate.ojolie.com/card/paper-snowflake

.htaccess http-status-code-301 http 重定向

评论

0赞 CBroe 10/17/2023
RedirectMatch 适用于正则表达式,并且由于您没有在开头和结尾锚定模式,因此模式当然也会匹配 on 等。/cards/corporate/cards/corporate/contactus
0赞 CBroe 10/17/2023
^将模式锚定到测试字符串的开头,并将其锚定到末尾。$RedirectMatch 301 ^/cards/corporate$ https://corporate.ojolie.com/home
0赞 John2 10/17/2023
@CBroe这就是问题所在。这样就解决了。非常感谢!

答: 暂无答案