【问题标题】:Redirection 301 with htaccess with url variables使用带有 url 变量的 htaccess 重定向 301
【发布时间】:2013-10-18 16:38:22
【问题描述】:

我在论坛上搜索过答案,但对我没有用。

我已经使用 Wordpress 重建了一个网站,并希望保留旧网址。

我有旧网址,例如:index.php?option=com_content&view=article&id=51&Itemid=67&lang=fr

我想永久移动到网址,例如:/produits-et-services/conseil-et-accompagnement/

重定向 301 不起作用,因为 URL 中的变量.. 我试过这个:

RewriteCond %{QUERY_STRING} ^option=com_content&view=article&id=51&Itemid=67&lang=fr$ [NC]
RewriteRule ^index.php$ http://solunea.fr/produits-et-services/conseil-et-accompagnement/ [L,R=301]

在我的 wordpress .htaccess 上,但也没有用。

有人可以帮帮我吗??

【问题讨论】:

    标签: php wordpress .htaccess mod-rewrite redirect


    【解决方案1】:

    确保这条规则:

    RewriteCond %{QUERY_STRING} ^option=com_content&view=article&id=51&Itemid=67&lang=fr$ [NC] 
    RewriteRule ^(index\.php)?$ /produits-et-services/conseil-et-accompagnement/ [L,R=301,NC]
    

    位于顶部任何其他现有重写规则之前

    并在不同的浏览器中测试以避免 301 缓存问题。

    【讨论】:

      猜你喜欢
      • 2021-01-06
      • 1970-01-01
      • 1970-01-01
      • 2019-02-23
      • 1970-01-01
      • 1970-01-01
      • 2012-12-08
      • 2014-12-04
      • 1970-01-01
      相关资源
      最近更新 更多