appending a parameter with .htaccess
i'm struggling with an htaccess rewrite command
what I have is
RewriteCond %{HTTP_HOST} ^www.mywebsite.co.uk$
RewriteCond %{REQUEST_URI} !^/subfolder/
RewriteRule ^(.*)$ /subfolder/
I have a few URLs going to the same folder, some of them redirect to subfolders, which then run different templates. However, I also开发者_Go百科 need to append a parameter to the end of every page that is redirected, eg, ?template=2
I can't just add it to the end manually, because some pages already have parameters, eg /?product=1 - so the second parameter needs to have the & sign not the ? sign.
Any help appreciated
You just need to add the QSA flag on the end of your rule:
RewriteRule ^(.*)$ /subfolder/?template=2 [QSA,L]
精彩评论