重写所有URL的一个问号 [英] Rewriting all url's with a question mark

查看:107
本文介绍了重写所有URL的一个问号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的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.

这篇关于重写所有URL的一个问号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆