【问题标题】:replace url with htaccess用 htaccess 替换 url
【发布时间】:2014-03-26 16:20:13
【问题描述】:

我需要删除网址的一部分。 Google 索引器检测到重复内容,我需要将 url 重定向到主要目标。

http://www.domain.com/index.php?id=123456.0

to main target:

http://www.domain.com/index.php?id=123456

我需要将第一个 url 重定向到第二个 url,方法是删除 .0 并在 htaccess 上使用 mod_rewrite。

谢谢。

【问题讨论】:

    标签: apache .htaccess url mod-rewrite


    【解决方案1】:

    您可以在根 .htaccess 文件中使用此规则:

    RewriteCond %{THE_REQUEST} \s/+(index\.php\?id=[^.]+)\.0\s
    RewriteRule ^ /%1 [L,R=301]
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-06-18
      • 2017-09-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多