问题描述
||
我目前正在尝试将RewriteRule放入我的Magento网站的.htaccess文件中,这将允许我以以下方式编写类别URL:
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
我希望将其呈现为好像该URL是:
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错误。有人可以指出正确的方向为我工作吗?
解决方法
我在服务器上尝试过
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]标志。