gpt4 book ai didi

apache - 需要在.htaccess中为Magento网站创建RewriteRule

转载 作者:行者123 更新时间:2023-12-02 04:09:00 24 4
gpt4 key购买 nike

我目前正在尝试将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]标志。

关于apache - 需要在.htaccess中为Magento网站创建RewriteRule,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6191900/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com