l1111l
Goto Top

HTACCESS Rewrite Rules kombinieren

Hallo zusammen,

ich bin auf ein kleines Problem gestoßen, dass ich aktuell noch nicht lösen konnte...

Ich möchte das alle Zugriffe auf meine Seite über HTTPS erfolgen.
Soweit mit dem Code kein Problem.

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Dazu sollen alle Zugriffe ohne www. erfolgen

Das funktioniert mit diesem Code auch ohne Probleme:
RewriteCond %{http_host} ^www\.domain\.tld [NC]
RewriteRule ^(.*)$ http://domain.tld/$1 [NC,QSA,R=301]


Jetzt möchte ich beide Regeln verbinden, das gelingt mir aber nicht.

Danke für eure Hilfe face-smile

LG

Jan

Content-Key: 373766

Url: https://administrator.de/contentid/373766

Printed on: April 24, 2024 at 09:04 o'clock

Member: wiesi200
Solution wiesi200 May 13, 2018 at 18:04:27 (UTC)
Goto Top
Hallo,

kleiner Tipp. Genau dafür gibt es HSTS
https://de.wikipedia.org/wiki/HTTP_Strict_Transport_Security
Mitglied: 136166
Solution 136166 May 14, 2018 updated at 05:50:45 (UTC)
Goto Top
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.tld [NC,OR]
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://domain.tld%{REQUEST_URI} [L,R=301]
Member: L1111L
L1111L May 14, 2018 at 17:37:33 (UTC)
Goto Top
Super!
Danke für eure Hilfe!