我正在经营一家网店,最近我的系统从xtcommerce改为gambio。由于gambio是xtc的一个分支,我认为URL处理是相同的,但似乎它们处理的东西有点不同。
我的旧网址如下: http://www.example.com/de/products/product.html 而新的是: http://www.example.com/product.html
所以现在有很多404,这对我的排名很不利。 有人可以帮我写一个正确的重定向,通过301重定向将旧网址映射到新网址吗?
这就是我的.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]
答案 0 :(得分:0)
我不确定为什么你的第一条规则不起作用。也许这会起作用:
RedirectMatch permanent ^/products/de/(.+) /$1
甚至只是
Redirect permanent /products/de/ /