I have tried several different redirect configuration in .htaccess to redirect all traffic to the https non-www URL of my site but can’t get https://www.example.com to redirect to https://example.com.
To be clear I want:
http://example.com
http://www.example.com
https://www.example.com
to redirect to
https://example.com
http to https://example.com works fine
EDIT:
I can’t remember the various combinations I used.
This is what I have set at the moment
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,NE]
</IfModule>
4
Answers
Try this:
From here.
You can use this :
Make sure to clear your browser cache before testing this.
I had problems on a domain where Safari refused to redirect from http to https using
I now have this working .htaccess content:
This is working for me. Try this