[英]Best way to redirect from one site to new site adding a querystring to it
I am trying to redirect with .htaccess from one site to another. 我正在尝试使用.htaccess从一个站点重定向到另一个站点。
However I want to add a querystring to the end of the URL that the redirect takes the person to. 但是我想在重定向将人员转到的URL的末尾添加一个查询字符串。 I have read lots of articles on here and they are about passing the querystring along to the new site, I just want to ADD a querystring (a promo code) to the rule.
我在这里阅读了很多文章,它们都是关于将querystring传递到新站点的,我只想将querystring(促销代码)添加到规则中。
Something like: 就像是:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP_HOST} site.com$ [OR]
RewriteCond %{HTTP_HOST} ^www.site.com$
RewriteRule (.*)$ https://www.newsite.com/subscribe.aspx?code=xxke [R=301,L]
</IfModule>
I have mod_rewrite enabled. 我启用了mod_rewrite。
Any ideas 有任何想法吗
Since ":" and "?" 由于“:”和“?” may be special characters in format strings consider escaping them as follows:
可能是格式字符串中的特殊字符,请考虑如下转义:
RewriteRule (.*)$ https\://www.newsite.com/subscribe.aspx\?code=xxke [R=301,L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.