【问题标题】:ModRewrite change in URL structureURL 结构中的 Mod_Rewrite 更改
【发布时间】:2013-07-14 18:20:08
【问题描述】:

我正在经营一家网上商店,最近将我的系统从 xtcommerce 更改为 gambio。由于 gambio 是 xtc 的一个分支,我认为 URL 处理是相同的,但似乎它们处理的事情有点不同。

我的旧网址如下: http://www.example.com/de/products/product.html 新的是: http://www.example.com/product.html

所以现在有很多 404,它们严重影响了我的排名。 有人可以帮我写一个正确的重定向,通过 301 重定向将旧 URL 映射到新 URL 吗?

这就是我的 .htaccess 的样子:

RewriteEngine on

RewriteRule   ^/products/de/(.+) /$1  [R,L] 
### This should do what I want but it doesn't ...

RewriteCond %{REQUEST_FILENAME} ^(.*)\.(php|css|js|gif|jpg|jpeg|png)$ [NC]
RewriteRule ^(.+) - [L]

RewriteCond %{REQUEST_URI} (.*)?/admin/(.*)
RewriteRule ^(.+) - [L]

RewriteCond %{REQUEST_URI} (.*)?/images/(.*)
RewriteRule ^(.+) - [L]

RewriteCond %{REQUEST_URI} (.*)?/templates/(.*)
RewriteRule ^(.+) - [L]

RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.+) - [L]

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^(.+) - [L]

RewriteCond %{REQUEST_FILENAME} -l
RewriteRule ^(.+) - [L]




##boosted CONTENT
RewriteRule (.*/)?info/([A-Za-z0-9_-]+)\.html.* shop_content.php?gm_boosted_content=$2&%{QUERY_STRING} [PT,L]

##boosted PRODUCTS
RewriteRule (.*/)?([A-Za-z0-9_-]+)\.html product_info.php?gm_boosted_product=$2&%{QUERY_STRING} [PT,L]

##boosted CATEGORIES
RewriteRule (.*/)?([A-Za-z0-9_-]+)/?.* index.php?gm_boosted_category=$2&%{QUERY_STRING} [L]

【问题讨论】:

    标签: .htaccess mod-rewrite gambio


    【解决方案1】:

    我不确定为什么您的第一条规则不起作用。也许这会起作用:

    RedirectMatch permanent ^/products/de/(.+) /$1
    

    甚至只是

    Redirect permanent /products/de/ /
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-08
      • 1970-01-01
      • 1970-01-01
      • 2016-01-08
      • 2016-01-13
      • 1970-01-01
      相关资源
      最近更新 更多