I'm using something similar to the following in my .htaccess file to redirect all http requests to https:
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
That works, except for a situation when a URL is passed with escaped parameters, as such:
http://www.example.com/download.php?go=app%20name
when redirected, it is mistakenly escaped again into:
https://www.example.com/download.php?go=app%2520name
How do I fix this?
Use NE or noescape flag in your rule:
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
Make sure to clear your browser cache before testing the change.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With