【问题标题】:Redirect old php link to wordpress link in .htaccess将旧的 php 链接重定向到 .htaccess 中的 wordpress 链接
【发布时间】:2017-06-15 05:26:39
【问题描述】:

我正在尝试使用 .htaccess 将旧页面链接重定向到新的 wordpress 链接,我尝试了以下两个重定向步骤,但它们都不起作用。

两者都在同一个域中,例如 www.example.com/folder/first-index.php?idTop=0 和 www.example.com/foldernew/products-list/

Redirect 301 "/folder/first-index.php?idTop=0" "/foldernew/products-list/"
RedirectPermanent /folder/first-index.php?idTop=0 /foldernew/products-list/ 

我正在尝试其他步骤,但没有运气。请任何人更正我的代码。谢谢。

【问题讨论】:

    标签: php wordpress apache .htaccess redirect


    【解决方案1】:

    请试试这个。它可能对你有帮助。

    [code autolinks=”false”]
    # 301 redirect for main pages
    RedirectMatch 301 ^/Your_old_path/$ http://Your_new_path/
    [/code]
    

    【讨论】:

      【解决方案2】:

      您可以尝试以下方法:

      RewriteEngine On
      RewriteCond %{REQUEST_URI} ^/folder/first-index\.php$
      RewriteCond %{QUERY_STRING} ^idTop=([0-9]*)$
      RewriteRule ^(.*)$ /foldernew/products-list/ [R=301,L]
      

      【讨论】:

        猜你喜欢
        • 2016-02-11
        • 2014-05-25
        • 1970-01-01
        • 2017-04-19
        • 2016-11-30
        • 1970-01-01
        • 2013-01-10
        • 2018-10-11
        • 1970-01-01
        相关资源
        最近更新 更多