【问题标题】:Trying to redirect old URL is closest new url using 301 redirectmatch尝试使用 301 redirectmatch 重定向旧 URL 是最接近的新 URL
【发布时间】:2016-09-20 05:51:30
【问题描述】:

拜托,这让我头疼!

我将旧网站 (goo.gl/onQ3UM) 重定向到新目录。 我将旧站点中的所有 URL 都重定向到了新主页(我现在意识到这是一个错误,因为上周初我收到了很多 404 和软 404)。

所以我现在尝试使用 301 重定向将每个页面分别重定向到最接近的匹配页面。

我将 htaccess 文件更改为: 重定向 301 /wp/new-homepage-feb162 /wp/home [(似乎工作正常)] RedirectMatch 301 /mjs/weddings/(.*) /wp/home/grand-country-house-weddings-and-receptions-dorset/

当我在 GSC goo.gl/onQ3UM/mjs/weddings/217-a-testimonial.html?7bffea3334ebaaaf8a005d78b5e86b8e= 300b60a21ae5159ab1e8cf12b7634b7b 中执行“获取”时 它显示为重定向到 /wp/home/grand-country-house-weddings-and-receptions-dorset/?7bffea3334ebaaaf8a005d78b5e86b8e= 300b60a21ae5159ab1e8cf12b7634b7b

这几乎是正确的,但我不想要 ?7bffea3334ebaaaf8a005d78b5e86b8e=300b60a21ae5159a b1e8cf12b7634b7b

我该如何摆脱它??!!!

【问题讨论】:

    标签: wordpress .htaccess seo http-status-code-301


    【解决方案1】:

    您编写此内容的方式非常令人困惑...但据我了解,您是在尝试使您的 URL 在重定向后看起来“更漂亮”吗?

    Options +FollowSymLinks -MultiViews
    RewriteEngine On
    RewriteBase /
    
    #To go from URL /example/example1/example2/example3
    #To go to URL /example3
    RewriteRule ^/example/example1/example2(/.+)$ /$1 [R=302,L,NC]
    

    所以上面会变成:

    www.example.com/example/example1/example2/example3
    

    进入:

    www.example.com/example3
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-12-27
      • 2017-02-27
      • 2015-03-30
      • 2010-11-09
      • 1970-01-01
      • 2012-01-27
      相关资源
      最近更新 更多