【问题标题】:301 Redirect old site URL's in new Drupal installation301 在新的 Drupal 安装中重定向旧站点 URL
【发布时间】:2012-02-06 15:32:02
【问题描述】:

我希望 301 将 URL 从不再使用的旧版本网站重定向到在全新 Drupal 安装中创建的新 URL。

旧网址:/198/our-software/

新网址:/services/software-development/

在位于 Drupal 根目录的 .htaccess 中,我添加了以下内容:

redirect 301 /198/our-software/ http://www.domain.com/services/software-development

重定向在某种程度上是有效的,它将用户发送到如下所示的 url,并在其末尾附加了一个查询字符串,这会导致 404 错误:

http://www.domain.com/services/software-development?q=198/our-software/

我尝试将重定向放在 .htaccess 文件的开头和结尾都导致 404 page not found 错误。

我是否需要使用更复杂的重定向来绕过 Drupal URL 重写?

注意:我正在使用 Pathauto 模块。

【问题讨论】:

    标签: .htaccess drupal drupal-6


    【解决方案1】:

    与其直接编辑 .htaccess,只需安装具有该功能的 Path Redirect module

    请注意,路径重定向模块仅适用于 Drupal 6(截至 2012 年 2 月 22 日)

    【讨论】:

    【解决方案2】:

    我改为使用“RewriteRule”,并且(重要!)删除源 URL 中的前导斜杠,所以在你的情况下:

    RewriteRule 198/our-software/ http://www.domain.com/services/software-development [R=301,L]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-07-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-11-05
      • 2017-02-27
      • 1970-01-01
      • 2013-08-01
      相关资源
      最近更新 更多