我从http重定向到https:
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://www.example.com/?utm_source=%{SERVER_NAME}&utm_medium=301&utm_campaign=www.example.com [R=301,L]
问题是,可能还有一个查询字符串,现在everthing已被删除,并且你登陆了起始页。如果我现在加上像这样的$ 1
RewriteRule ^/?(.*) https://www.example.com/$1?utm_source=%{SERVER_NAME}&utm_medium=301&utm_campaign=www.example.com [R=301,L]
网址从第二个“?”切断了在“$ 1”中的问号之后
所以我希望有这样的东西
RewriteCond %{HTTPS} !=on
RewriteCond %{QUERY_STRING} ?
RewriteRule ^/?(.*) https://www.example.com/$1&utm_source=%{SERVER_NAME}&utm_medium=301&utm_campaign=www.example.com [R=301,L]
RewriteCond %{QUERY_STRING} !?
RewriteRule ^/?(.*) https://www.example.com/$1?utm_source=%{SERVER_NAME}&utm_medium=301&utm_campaign=www.example.com [R=301,L]
但是这样做了,所以你有什么想法吗? 谢谢