I am having issues setting up some mod_rewrite rules to hide extra query strings from my snippet. I have an extra query string called template that looks like the following :
?template=rss
?template=popular
?template=live
i would like to do some rewrite rules that will alow those urls to be called like the following :
/document-alias/rss
/document-alias/popular
/document-alias/live
I have managed to get it to work with the following Rule
RewriteRule ^(.*)/(.*)$ index.php?q=$1&template=$2 [L,QSA]
However this breaks all existing urls without a final backslash /
so /document-alias/rss
or
/document-alias/
works
but
/document-alias
does not.
Can anyone see whats going wrong?
A live example of where this rule could be used, is on the package repositry - a url like :
http://modxcms.com/extras/repository/packages.html?tag=Forms
could be rewritten like :
http://modxcms.com/extras/repository/packages/tag/forms
PS. Here are my current url settings in modx if it helps
Use friendly URLs: Yes
Prefix for friendly URLs:
Suffix for friendly URLs:
Use friendly aliases: Yes
Use friendly alias path: No
Allow duplicate aliases: Yes
Automatically generate alias: Yes