Weiterleitung http > https …

Der folgende Code bewirkt die Weiterleitung von "http" auf "https":
Show Plain Text
  1. RewriteEngine On
  2. RewriteCond %{HTTPS} !=on
  3. RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

s.a. https://wiki.apache.org/httpd/RewriteHTTPToHTTPS


Der folgende Code sollte sowohl von "http" auf "https" weiterleiten als auch ein fehlendes "www" ergänzen:
Show Plain Text
  1. RewriteEngine on
  2. RewriteCond %{HTTPS} off [OR]
  3. RewriteCond %{HTTP_HOST} !^www\.
  4. RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [NE,L,R]

s.a. https://stackoverflow.com/questions/13977851/htaccess-redirect-to-https-www
----------
Christian, MacFix.