htaccess Domain auf https umleiten, Subdomain auf http und www auf non-www

Ich versuche das zu tun:

Erzwinge das https für meine Hauptdomain.

http or https://www.domain.com  -> https://domain.com
http or https://domain.com  -> https://domain.com

Aber nicht für Subdomains

http or https://www.subdomain.domain.com -> http://subdomain.domain.com
http or https://subdomain.domain.com -> http://subdomain.domain.com

Und immer das www entfernen.

Jetzt habe ich das:

RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Dies leitet www zu Nicht-www und http zu https weiter, jedoch nicht zu Subdomains. Die Subdomain bleibt bei www und https.

Vielen Dan

Antworten auf die Frage(6)

Ihre Antwort auf die Frage