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
LG
Jan
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
LG
Jan
Please also mark the comments that contributed to the solution of the article
Content-Key: 373766
Url: https://administrator.de/contentid/373766
Printed on: April 24, 2024 at 09:04 o'clock
3 Comments
Latest comment
Hallo,
kleiner Tipp. Genau dafür gibt es HSTS
https://de.wikipedia.org/wiki/HTTP_Strict_Transport_Security
kleiner Tipp. Genau dafür gibt es HSTS
https://de.wikipedia.org/wiki/HTTP_Strict_Transport_Security
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www\.domain\.tld [NC,OR]
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://domain.tld%{REQUEST_URI} [L,R=301]