帮助.htaccess重写

时间:2010-12-17 03:33:37

标签: apache .htaccess mod-rewrite

我在尝试设置.htaccess以便按照我想要的方式拥有Magento网址时遇到了一些问题。

我想像这样重定向网址:

  • domain.com/fr/store 从中加载 的 domain.com/store?__商店=法国
  • domain.com/fr/store/category.html 来自 的 domain.com/store/category.html?__商店=法国
  • domain.com/fr/store/category/product.html 来自 的 domain.com/store/category/product.html?__商店=法国

这是我到目前为止所做的:

RewriteRule ^fr/store(.*)$ /store/$1?___store=france [L,P]

它可以将所有内容重定向到主存储,但我无法访问子目录或页面。

1 个答案:

答案 0 :(得分:0)

^(.*)$模式捕获当前URI,无论它位于位置栏中还是内部重定向。其中一个解决方案应该有效:

  • 首先放置子域重定向
  • $1替换为变量,例如%{REQUEST_URI}

此答案是从this answer复制的;它最初由用户ÁlvaroG。Vicario撰写。