This has been asked multiple times, but none of the answers have worked for me.
I have just installed an SSL certificate and need to force https connections for all visitors.
This site has a lot of incoming links, so all existing http links should properly redirect to https.
There should be no www. There is also a rule that removes .html from files for "friendly" URLs, so that has to continue to work.
This is the old htaccess:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\.]+)$ $1.html [NC,L]
What is the new set of rules I need to use?
ReWriteCond %{SERVER_PORT} !^443$
RewriteRule ^/(.*) https://%{HTTP_HOST}/$1 [NC,R,L]
– Evgeniy Sep 20 '15 at 18:40http://example.com/$1
tohttps://example.com/$1
then use any non-ssl to ssl. and ensure that they don't loop. There's several posts on Stack Overflow related questions and answers i.e stackoverflow.com/questions/19359444/… – Simon Hayter♦ Sep 20 '15 at 21:58