我想使用example.com域为虚拟服务器设置apache配置。调用此域时,只要用户正在该域上冲浪,就应该通过mod_rewrite添加具有静态值的变量。
https://example.com应该是https://example.com?space=5555
https://example.com/home.php应该是https://example.com/home.php?space=5555
https://example.com/home.php?systemid=1会https://example.com/home.php?systemid=1&space=5555
答案 0 :(得分:0)
解决了这个问题
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteCond %{QUERY_STRING} "!space"
RewriteRule "^/(.*)$" "/$1?space=5555$1%{QUERY_STRING}" [L,R]