.htaccess redirect error on mobile

Joined
Nov 29, 2015
Messages
58
Likes
60
Degree
0
So I've been pulling my hair out all day - I made the decision to buy an SSL cert for my blog and the upgrade has gone really well - all content is now switched over.

However....

For some reason on mobile, my htaccess is causing a too many redirect error, this is what I've got...
Code:
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Any idea what needs to be changed to get this working?

I think it's got something to do with forcing www but I'm not 100%...
 
Update: not sure why but after following the link from @SmokeTree I was still getting the issue. The following code seems to have fixed it though...

Code:
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.example.com/$1 [R=301,L]
 
Glad you got it sorted. If this is a VPS and you have root/sudo access, it's best to put that in the config file for the vhost rather than .htaccess
 
Back