2

I have a webserver running apache2 with php7.

In my apache config, there is a redirect rule like the following:

RewriteCond %{HTTP_HOST} !^www.*
RewriteRule .* %{HTTP:X-Forwarded-Proto}://www.%{HTTP_HOST}%{REQUEST_URI} [QSA,R=301,L]

This should perform a redirect form http(s)://example.com/scpript?param1=x&param2=y to http(s)://www.example.com/scpript?param1=x&param2=y

It basically works, with one exception: only the first get parameter gets passed to the rewitten url, so my client actually recieves http(s)://www.example.com/scpript?param1=x as redirection target.

I'm quite puzzled, how do I get the system to pass the full query along?

if also tried

RewriteRule .* %{HTTP:X-Forwarded-Proto}://www.%{HTTP_HOST}%{REQUEST_URI}?%{QUERY_STRING} [QSA,R=301,L]

But that redirects me to http(s)://www.example.com/scpript?param1=x&param1=x. It looks like something omits the other parameters before the rewrite comes into action.

  • There would seem to be "something else" going on here. Since you appear to be behind a proxy server (and the `QUERY_STRING` server variable is modified) I suspect your proxy server is modifying the request and stripping this other parameter as it is passed through? – MrWhite Sep 19 '17 at 15:46

0 Answers0