【问题标题】:Setup 301 redirect for .html pages Wordpress为 .html 页面设置 301 重定向 Wordpress
【发布时间】:2019-11-16 13:15:53
【问题描述】:

您好,我已将我的商店从 Magento 迁移到 Wordpress,我想为 /product.html 但现在只是 /product 的产品页面设置 301 重定向,我在 .htaccess 文件中使用了以下代码,它有效但是它使主页中断,我该如何更改此代码以使主页仍然有效?

redirectMatch 301 ^(.*).html$ $1

【问题讨论】:

    标签: wordpress .htaccess redirect


    【解决方案1】:

    你可以忽略索引页:

    redirectMatch 301 ^(?!/index\.html$)(.*)\.html$ $1
    

    【讨论】:

    • 谢谢,我现在已经尝试过了,但是当我输入主页时,url 从 example.com 变为 example.com/index 并出现 404 not found 页面?
    • 仍然无法正常工作,只是说主页找不到页面
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-10-09
    • 2016-03-25
    • 1970-01-01
    • 1970-01-01
    • 2017-03-06
    • 2013-05-20
    • 1970-01-01
    相关资源
    最近更新 更多