Ich möchte alle non-www
und alle non-https
zu https://www
URL umleiten.Falsche Umleitung von .htaccess
Ich habe eine .htaccess den folgenden Code enthält:
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule ^(.*)$ https://www.%{HTTP_HOST}%{REQUEST_URI}$1 [R=301,L]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI}$1
, die für den Root-Pfad arbeitet:
OK https://www.mywebsite.com => https://www.mywebsite.com
OK http://mywebsite.com => https://www.mywebsite.com
OK https://mywebsite.com => https://www.mywebsite.com
OK http://www.mywebsite.com => https://www.mywebsite.com
Aber es gibt (Art) einen Fehler, wenn ich versuche zu gehen im Unterordner:
OK https://www.mywebsite.com/tmp => https://www.mywebsite.com/tmp
KO https://mywebsite.com/tmp => https://www.mywebsite.com/tmp/tmp
KO http://www.mywebsite.com/tmp => https://www.mywebsite.com/tmp/tmp
KO http://mywebsite.com/tmp => https://www.mywebsite.com/tmp/tmp
Wie Sie sehen können, wird der Unterordner erneut angefügt und es wird ein Fehler 404 angezeigt.
Wie kann ich meine .htaccess-Regeln reparieren, um die erwarteten Weiterleitungen zu erhalten?
Vielen Dank
Vielen Dank es funktioniert wie ein Charme! – void