【问题标题】:htaccess original rewrites already usedhtaccess 原始重写已经使用
【发布时间】:2011-12-19 13:23:06
【问题描述】:

好的,所以我有一个网站,它已经采用了 SEO 的 URL 并解析了信息,以便我可以在它们各自的页面上获取它们的内容。

htaccess 文件中的代码如下所示:

RewriteCond %{REQUEST_URI} !^/(email)/
RewriteRule ^([A-Za-z0-9-]+)\.html /page.php?seo_title=$1 [L]
RewriteCond %{REQUEST_URI} !^/(email)/
RewriteRule ^([A-Za-z0-9-]+)/([A-Za-z0-9-]+)\.html /page.php?seo_title=$2&seo_parent=$1 [L]

所以现在有几页已经改变了:

old-parent-name/seo-title.html 到 new-parent-name/seo-title.html

但是当我尝试进行任何类型的常规 301 重定向时,URL 字符串会像这样结束:

http://www.example.com/new-parent/old-seo-title.html?seo_title=old-seo-title&seo_parent=new-parent

有什么办法可以让查询字符串不出现?

提前致谢。

【问题讨论】:

    标签: .htaccess


    【解决方案1】:

    尝试将其添加到您拥有的规则之上:

    RewriteCond %{REQUEST_URI} !^/(email)/
    RewriteRule ^old-parent-name/([A-Za-z0-9-]+)\.html /new-seo-parent/$1.html [L,R=301]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-11-17
      • 1970-01-01
      • 2013-05-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多