【问题标题】:Redirect 301 www.example.com/directory/tour1 to www.example.com/tour1将 301 www.example.com/directory/tour1 重定向到 www.example.com/tour1
【发布时间】:2014-09-27 15:03:47
【问题描述】:

您好,我遇到了神秘的 HTACCESS 文件的情况。我正在尝试修复损坏的 URL。 此文件夹从未存在是在 WP 中创建的永久链接。我需要重定向 301 所有这些损坏的链接以避免 Google 出现问题。

以前的网址是这样的

www.example.com/directory/tour1,   www.example.com/directory/tour2,   www.example.com/directory/tour3 and so on.

现在 url 已经改变,所以所有的游览都在根目录下

 www.example.com/tour1, www.example.com/tour2...

我需要对 www.example.com/directory/WHATEVER 进行所有查询

指向 www.example.com/WHATEVER

感谢您帮助我了解重定向世界... \

我已经尝试了很多代码,但没有一个能完成这项工作。

RewriteRule ^tulum-tours/(.*) http://www.aguaclaraproject.com/

【问题讨论】:

    标签: .htaccess redirect


    【解决方案1】:

    在您的 www-root 中的 .htaccess 中使用以下规则:

    RewriteEngine on
    
    RewriteRule ^tulum-tours/(.*)$ /$1 [R,L]
    

    在测试正常工作后将 R 标志更改为 R=301。阅读the documentation了解更多信息。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-11
      • 1970-01-01
      • 2021-09-16
      • 2017-10-26
      相关资源
      最近更新 更多