【问题标题】:301 redirect destination url format301重定向目标url格式
【发布时间】:2013-09-20 04:56:42
【问题描述】:

我正在尝试在我的网站上进行一些 301 url 重定向,这是 .htaccess 文件的前几行:-

RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]


Redirect 301 /en/home/index.html /index.php?
Redirect 301 /en/about/product.html /shop?
Redirect 301 /en/member/profile.html /index.php?route=account/account

以上所有 3 301 规则都可以正常工作。但是当我删除“?”在第一条和第二条规则中,重定向失败。所以在这种情况下,“?”必须在场。

但是,如果我希望有没有“?”的格式,可以吗?

另外,如果我只做url rewrite,不做301重定向,还会保持之前的seo成就吗?

【问题讨论】:

    标签: .htaccess seo


    【解决方案1】:

    尝试使用 mod_rewrite 代替 mod_alias:

    RewriteRule ^en/home/index.html$ /index.php? [L,R=301]
    RewriteRule ^en/about/product.html$ /shop? [L,R=301]
    RewriteRule ^en/member/profile.html$ /index.php?route=account/account [L,R=301]
    

    你还需要那些在你的 index.php 路由规则之前。

    【讨论】:

      猜你喜欢
      • 2014-01-23
      • 2013-03-04
      • 2014-09-03
      • 2011-04-29
      • 1970-01-01
      • 2013-07-02
      • 1970-01-01
      • 2012-10-20
      • 2013-12-21
      相关资源
      最近更新 更多