I have a working RewriteRule:
RewriteRule ^category/?(.*)/([0-9]+)/([0-9]+)/([a-z]+)-([0-9]+)$ category.php?%{QUERY_STRING}&id=$2&paginate=$3&sort=$4&page=$5 [L]
Processed URL looks like:
www.mysite.com/category/hockey/10/18/recent-3
Now I want my URL to look like:
www.mysite.com/category/hockey?id=10&paginate=18&sort=recent-3
I have tried:
RewriteRule ^category/?(.*)?id=([0-9]+)&paginate=([0-9]+)&sort=([a-z]+)-([0-9]+)$ category.php?%{QUERY_STRING}&id=$2&paginate=$3&sort=$4&page=$5 [L]
but I couldn’t make it work.
Any ideas?
You can’t match against the query string (everything after the
?in the URL) in aRewriteRule. You have to do it against the%{QUERY_STRING}variable and backreference using the%: