How can I redirect from http to https via htaccess?

RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.domain\.org$
RewriteRule .? http://www.domain.org%{REQUEST_URI} [R=301,L]
RewriteCond %{SERVER_PORT} ^80$
RewriteRule .? https://www.domain.org%{REQUEST_URI} [R,L]

(From SSL + www .htaccess - #2 by Gandalf)

1 Like