Ich habe keine Ahnung, warum dies fehlschlägt. Ich möchte nur alle Domain zu www.maindomain.com
und http
zu https
umleiten, was fehlt mir?Apache2 Redirect zu einer anderen Domäne mit ssl
# redirect http to https
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# redirect without www to www
RewriteCond %{http_host} ^maindomain.com [nc]
RewriteRule ^(.*)$ https://www.maindomain.com [r=301,nc]
# redirect another domain to www.maindomain.com
RewriteCond %{HTTPS} off # this i was missing
RewriteCond %{HTTP_HOST} ^(www\.)?anotherdomain.com [NC]
RewriteRule ^(.*)$ https://www.maindomain.com [R=301,L]
http://maindomain.com
zuhttps:/www.maindomain.com/
arbeitethttp://anotherdomain.com
-https:/www.maindomain.com/
arbeitethttps://anotherdomain.com
-https:/www.maindomain.com/
seltsam, der Kommentar mit der RewriteCond% {HTTPS} aus, Hinweis war richtig, es funktioniert jetzt, aber die Antwort wurde gelöscht, gerade als ich es akzeptieren wollte, fehlte mir ein 2. RewriteCond in der 3. Weiterleitung –