I want to understand where is my mistake. I have an issue on my .htaccess, I want to redirect all the basics entries to https://www.example.com.
http://example.com to https://www.example.com
http://www.example.com to https://www.example.com
https://example.com to https://www.example.com
http://example.com/index.html to https://www.example.com
http://www.example.com/index.html to https://www.example.com
https://example.com/index.html to https://www.example.com
Everything has to be redirected to https://www.example.com but for the moment it doesn't work. Where is my error, and how can I improve the code?
My code:
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP:X-Forwarded-SSL} !on
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^/?$ "https\:\/\/www\.example\.com\/" [R=301,L]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{REQUEST_URI} ^(.*/)index\.html$ [NC]
RewriteRule . http://www.%{HTTP_HOST}%1 [R=301,NE,L]
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule . http://www.%{HTTP_HOST}%{REQUEST_URI} [NE,R=301,L]
RewriteCond %{REQUEST_URI} ^(.*/)index\.html$ [NC]
RewriteRule . %1 [R=301,NE,L]
Possible duplicate
Maybe I don't understand something but for me htaccess redirect to https://www doesn't answer my question, because it doesn't fix the /index.html part of my question.