This question has been asked a million times before but my problem is that this still doesn't work for me, regardless of what code I use so I was wondering if I could have some help perhaps?
This is my current htaccess and it does successfully remove the www, but the https doesn't work at all. I want it to redirect all traffic to https://example.com
if the requested url uses www or http. Any help please? Thanks a bunch!
RewriteCond %{HTTPS} !on
RewriteCond %{HTTP_HOST} !^example.com
RewriteRule ^(.*)$ https://example.com/$ [L,R=301]
- note: the rewrite engine is on, it's a few lines above.
RewriteCond %{HTTPS} !=on [OR]
(you are missing the equals sign and either it or the other rule should trigger the redirect).$
should also be$1
to substitute everything in the parenthesis.