2011-05-31 82 views
3

目前我试图把一个重写规则到我的.htaccess文件我的Magento的网站,将让我写在下面的方式分类网址:需要建立在.htaccess重写规则一的Magento的网站

http://mydomain.com/dir/<direction>/order/<order>/<Magento category URL path>.html 

我基本上想要做的就是使用我的robots.txt文件来使某些类别URL不出现(特别是当您对类别应用不同的排序顺序时)。

因此,让我们假设我有以下网址:

http://mydomain.com/dir/asc/order/sales_index/footwear/mens-work-boots/motorcycle-boots.html 

我想,要被渲染,就像它的网址是:

http://mydomain.com/footwear/mens-work-boots/motorcycle-boots.html?dir=asc&order=sales_index 

我已经把我的代码。 htaccess文件如下:

RewriteRule ^dir/(.*?)/order/(.*?)/(.*?)$ $3.html?dir=$1&order=$2 

由于某种原因,当我有这个在那里,我得到一个404错误。有人能指引我朝着正确的方向为我工作吗?

回答

1

我本想我的服务器

RewriteRule ^(.*)/dir/(.*?)/order/(.*?)/(.*?)$ $4.html?dir=$2&order=$3 [R,L] 

上,当我发出请求

http://myserver/dir/asc/order/sales_index/footwear/mens-work-boots/motorcycle-boots.html 

我得到正确重定向到

http://yuave.dev:81/footwear/mens-work-boots/motorcycle-boots.html.html?dir=asc&order=sales_index 

可能是你缺少[L]国旗在您的要求。