2011-05-31 80 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]國旗在您的要求。