I am trying to redirect all non-domain requests to www while keeping the request URI.
I use this in my .htaccess file to redirect:
RewriteCond %{HTTP_HOST} ^[^.]+\.[^.]+$ RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=302]
The problem is that when I have a query like this:
example.com/search/?name=läkare
It redirects to:
www.example.com/search/?name=l%25C3%25A4kare
Which type is incorrect, it encodes it twice. I check this as follows:
<?php echo rawurlencode('läkare');//outputs l%C3%A4kare echo "\n"; echo rawurldecode('l%25C3%25A4kare');//outputs l%C3%A4kare echo "\n"; echo rawurldecode(rawurldecode('l%25C3%25A4kare'));//outputs läkare
Why does he code it twice and how can I make him do it? I'm fine with 1 encoding, but 2 is too much.
source share