You need to create a RewriteRule in .htaccess for the Magento website

I am currently trying to put a RewriteRule in my .htaccess file for my Magento website, which will allow me to write the category URL as follows:

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

Basically, I want to use a robots.txt file so that some category URLs are not displayed (especially when you apply a different sort order to the category).

So let's say I have the following URL:

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

I would like this to appear as if it were a URL:

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

The code I installed in my .htaccess looks like this:

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

For some reason, when I have this, I get 404 error. Can someone point me in the right direction to make this work for me?

+3
source
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] .

+1

All Articles