我想在Apache中設置一個重定向,添加一個查詢字符串。我不認爲我想使用RewriteRule,因爲目標是一個不同的網絡服務器。我現在是這樣的:apache重定向追加查詢字符串
<VirtualHost 127.0.0.5:4039>
ServerName localhost.redirect
RedirectMatch (.*) http://otherserver.com$1?originalHost=127.0.0.5
</VirtualHost>
這工作,因爲請求到http://127.0.0.5:4039/foo
被重定向到http://otherserver.com/foo?originalHost=127.0.0.5
。問題是,http://127.0.0.5:4039/foo?another=value
也被重定向到http://otherserver.com/foo?originalHost=127.0.0.5
,我希望像http://otherserver.com/foo?another=value&originalHost=127.0.0.5
這樣的原始查詢字符串被保留。
有關如何做到這一點的任何提示?我在WAMP上運行,並不是很擅長這個apache的東西。
這裏有一個相關的問題,其中有人有一個重定向,其中目標包括一個查詢字符串:Apache: Redirect domain to other domain with appended querystring。他們並不試圖追加一個querystring,只是設置一個。