我使用的Magento和每一个URL是acessible在两个方面,例如:
I'm using magento and every url is acessible in two ways for example:
http://www.mysite.com/product-item
和
www.mysite.com/product-item?___店=默认
http://www.mysite.com/product-item
, and
www.mysite.com/product-item?___store=default
我尝试了常规的301重定向的的.htaccess
,但它不会重定向。有没有人有code,它会自动重定向所有网址的后缀为?___店=默认
返回到干净的URL,从而避免重复内容的问题?
I tried a regular 301 redirect in .htaccess
but it won't redirect. Does anyone have the code that would automatically redirect all url's with the suffix ?___store=default
back to the clean url's thus avoiding duplicate content issues?
尝试:
RewriteEngine On
RewriteCond %{THE_REQUEST} ?___store=default
RewriteRule ^(.*)$ /$1? [L,R=301]
或
RewriteEngine On
RewriteCond %{QUERY_STRING} ___store=default
RewriteRule ^(.*)$ /$1? [L,R=301]
根据查询字符串是如何产生的。之所以重定向301
可能没有工作,你可以对查询字符串使用的语句不匹配。
depending on how the query string is generated. The reason why a Redirect 301
probably didn't work is that you can't match against query strings using that statement.