.htaccess http to https with URL params

I know this is technically not a Yii issue, but im trying to achieve something as a result of using Yii…

I need to transport all visitors to HTTPS, I achieve this by doing:

RewriteEngine On

RewriteCond %{SERVER_PORT} 80

RewriteRule ^(.*)$ https://sub.brsequity.co.uk/$1 [R,L]

This works fine, but, if you for example click on Lost Password, your’e taken to a URL with parameters, and the above rule doesnt carry them accross, so it results in a “incorect link” error…

How can i ensure that the URL and parameters are passed to the new HTTPS rewrite?

I also tried below with the REQUEST_URI, but doesnt work…

RewriteEngine On 

RewriteCond %{HTTPS} !=on

RewriteRule .* https://%{SERVER_NAME}%{REQUEST_URI} [R,L]


Try QSA (Query String Append) with your rewrite rule.

Thanks, i will look into it, but just tried his, and it doesnt do anything different

RewriteEngine On

RewriteCond %{SERVER_PORT} 80

RewriteRule ^(.*)$ https://bcd.brsequity.co.uk/$1 [R,L,QSA]

Hm, maybe you’ll find something useful here.