开发者

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]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜