i am battling by having an htaccess rewrite command

things i have is

RewriteCond %{HTTP_HOST} ^www.mywebsite.co.uk$
RewriteCond %{REQUEST_URI} !^/subfolder/ 
RewriteRule ^(.*)$ /subfolder/

I've got a couple of Web addresses visiting the same folder, a number of them redirect to subfolders, which in turn run different templates. However, I should also append a parameter towards the finish of each and every page that's reditected, eg, ?template=2

I can not just combine it with the finish by hand, becuase some pages curently have paremeters, eg /?product=1 - therefore the second parameter will need the &lifier sign not the ? sign.

Any help appreciated


You need to simply add the QSA flag on the end of your rule:

RewriteRule ^(.*)$ /subfolder/?template=2 [QSA]