Greetings. I was wondering if I could use a query param as a part of SEO url, e.g., I want www.site.com/catalog/wine?type=red transform to www.site.com/catalog/wine/red, I’ve tried adding this to .htaccess:
RewriteRule ^(.)/(.)$ index.php?q=$1&type=$2 [L,QSA]
Actually it’s the latest version of rewrite rule I’ve tried, I’ve also tried several others like this one:
RewriteRule ^([^/]*)/catalog/wine/$ /catalog/wine?type=$1 [L]
Wether it’s more suitable to manage from MODX (CustomRequest or other plugin) or htaccess is debatable depending on the use case. The htaccess approach is probably a little more performant at the trade-off of needing to manage it in a file.
@halftrainedharry, I’ve tried it but with this extension I can only do a redirection from www.site.com/catalog/wine/red to www.site.com/catalog/wine?type=red which is not what I’ve wanted (this query param rewriting is for SEO purposes), I was wondering if I’m doing something wrong? I’ve added ‘catalog/wine/red’ to the ‘Alias Path’ and pointed it to my Red Wines resource, it does the redirect but I still can see the ‘catalog/wine?type=red’ in the address bar.
@bobray, that’s what I’ve wanted, but for some reason it’s not working, the url’s not being rewritten.
The problem is that there are some quirky snippets for filtering products that need to be modified to work with new urls, so I wanted to go with a quick rewriting solution, well, seems that I’ll need to do a bit of R&D.
I definitely tested that .htaccess section. Do you have non-alphanumeric characters or spaces in your type=... section? Have you tried moving the rules above the MODX FURL section (but after the RewriteBase and engine on statements)?
If it’s just one page, bruno17’s suggestion is probably easier.