Apache .htaccess,重写规则在末尾添加字符串

Apache .htaccess,重写规则在末尾添加字符串,apache,.htaccess,mod-rewrite,Apache,.htaccess,Mod Rewrite,使用该代码: RewriteEngine On RewriteCond %{HTTP_HOST} ^www.edutic\.ch [NC] RewriteRule ^/?(.*) www.emitic.ch/new/$1 [L,R=301] www.edutic.ch/?p=1767 变成 www.emitic.ch/new/?p=1767 但我需要在末尾添加:&option=com\u wordpress&Itemid=143 我想要 www.edutic.ch/?p=1767 成

使用该代码:

RewriteEngine On
RewriteCond %{HTTP_HOST}   ^www.edutic\.ch [NC]
RewriteRule ^/?(.*) www.emitic.ch/new/$1 [L,R=301]

www.edutic.ch/?p=1767
变成

www.emitic.ch/new/?p=1767
但我需要在末尾添加:
&option=com\u wordpress&Itemid=143

我想要

www.edutic.ch/?p=1767
成为

www.emitic.ch/new/?p=1767&option=com_wordpress&Itemid=143
如何更改重写规则?

您可以使用此规则:

RewriteEngine On

RewriteCond %{HTTP_HOST} ^www\.edutic\.ch$ [NC]
RewriteRule ^/?(.*)$ http://www.emitic.ch/new/$1?&option=com_wordpress&Itemid=143 [QSA,L,R=301]

很高兴知道答案是正确的,你能通过点击我答案左上角的勾号将答案标记为已接受吗。