Opened 10 years ago
Last modified 8 years ago
#775 reopened Bug/Fehler
Optimierte .htaccess (bitte diskutieren)
| Reported by: | Torsten Riemer | Owned by: | somebody |
|---|---|---|---|
| Priority: | hoch | Milestone: | |
| Component: | Shop | Version: | 2.0.0.0 |
| Keywords: | Cc: | ||
| Blocked By: | Blocking: |
Description (last modified by )
Wir haben von cYbercOsmOnauT eine optimierte .htaccess erhalten, die ich in r9421 ins SVN geladen habe.
Im Demoshop 2.00 ist die neue Version der .htaccess bereits aktiviert!
Bitte testen und mögliche Probleme hier diskutieren.
Attachments (0)
Change History (53)
comment:1 by , 10 years ago
| Description: | modified (diff) |
|---|
comment:2 by , 10 years ago
comment:3 by , 10 years ago
| Priority: | normal → hoch |
|---|
comment:6 by , 10 years ago
| Milestone: | modified-shop-2.0.0.0 → modified-shop-2.0.0.1 |
|---|---|
| Resolution: | fixed |
| Status: | closed → reopened |
| Type: | Frage → Bug/Fehler |
Die .htaccess muss nochmal überarbeitet werden!
Problem:
Weiterleitung von:
http://www.example.com/shoproot/category/product-1::1.html
nach:
https://www.example.com/category/product-1::1.html
funktioniert nicht!
Es wird dann weitergeleitet nach:
comment:7 by , 10 years ago
Bitte damit mal testen
##-- redirect to www-domain, when www is missing and no subdomain given and not using an ssl-proxy
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} !\.(.*)\. [NC]
RewriteCond %{HTTP_HOST} !^localhost [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
##-- redirect to https-domain (Do not uncomment if you only have a SSL-Proxy!)
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
comment:8 by , 10 years ago
Das ist doch genau mein Code aus Kommentar 6. Damit hatte ich doch getestet.
Bei dir ist doch nun nur noch hinzugekommen:
RewriteCond %{HTTP_HOST} !\.(.*)\. [NC]
RewriteCond %{HTTP_HOST} !^localhost [NC]
comment:9 by , 10 years ago
Das ist wichtig damit das auch unter localhost noch funktioniert, das osllte man nicht vergessen.
Im Prinzip haben wir 2 Umleitungen:
- auf www wenn nicht www und nicht localhost
- auf https wenn nicht https
Problem bei www Weiterleitung UND https Weiterleitung: es wird 2mal weitergeleitet.
Deshalb sollte man im oberen Block noch eine Alternative anbieten:
Weiterleitung auf https mit www
RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
comment:12 by , 10 years ago
Zu dem Problem mit $1 und %{REQUEST_URI} kann ich nur sagen mea culpa. Ich habe übersehen, das $1 zwar die URI des Requests enthält, jedoch relativ zum Pfad des Rewrites (also wo die .htaccess drinsteckt). Und das noch verknüpft mit RewriteBase bringt den Rewriter dazu direkt in den Docroot umzulenken. Besser ist deswegen die Nutzung von %{REQUEST_URI} wie bereits oben vorgeschlagen.
##-- redirect to www-domain, when www is missing and no subdomain given and not using an ssl-proxy
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteCond %{HTTP_HOST} !\.(.*)\. [NC]
RewriteCond %{HTTP_HOST} !^localhost [NC]
RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
##-- redirect to https-domain (Do not uncomment if you only have a SSL-Proxy!)
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
comment:14 by , 9 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
Ich muss das Ticket nochmal öffnen, da mich Markus darauf aufmerksam gemacht hat, dass die doppelte Umleitung für http://example.com nach http://www.example.com und dann weiter nach https://www.example.com bei Google PageSpeed 9 Punkte kostet.
Zielseiten-Weiterleitungen vermeiden
Ihre Seite enthält 2 Weiterleitungen. Weiterleitungen verzögern das Laden der Seite.
Vermeiden Sie Zielseiten-Weiterleitungen für die folgende Kette weitergeleiteter URLs.
Daher der Vorschlag den Teil wie folgt zu aktualisieren:
##-- redirect to http www-domain, when www is missing and no subdomain given and not using an ssl-proxy
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteCond %{HTTP_HOST} !\.(.*)\. [NC]
#RewriteCond %{HTTP_HOST} !^localhost [NC]
#RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
##-- redirect to https www-domain, when www is missing and no subdomain given and not using an ssl-proxy
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteCond %{HTTP_HOST} !\.(.*)\. [NC]
#RewriteCond %{HTTP_HOST} !^localhost [NC]
#RewriteCond %{HTTPS} off
#RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
comment:15 by , 9 years ago
Hi Torsten,
ich denke das wird nicht gehen.
Damit wird zwar http://example.com umgeleitet aber nicht https://example.com und auch nicht http://www.example.com
So sollte es mit einem [OR] (or next) gehen:
##-- redirect to https www-domain, when www is missing and no subdomain given and not using an ssl-proxy
#RewriteCond %{HTTP_HOST} !^www\. [NC,OR]
#RewriteCond %{HTTPS} off
#RewriteCond %{HTTP_HOST} !\.(.*)\. [NC]
#RewriteCond %{HTTP_HOST} !^localhost [NC]
#RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
comment:16 by , 9 years ago
Stimmt! Daran hatte ich gar nicht gedacht...
Was nun damit aber auch immer noch nicht umgeleitet wird ist:
http://www.example.com -> https://www.example.com
Es muss doch möglich sein das ohne doppelte Umleitung hinzubekommen!?
comment:17 by , 9 years ago
#RewriteCond %{HTTP_HOST} !^www\. [NC,OR]
#RewriteCond %{HTTPS} off [OR]
#RewriteCond %{HTTP:X-Forwarded-Proto} !https
#RewriteCond %{HTTP_HOST} !\.(.*)\.
#RewriteCond %{HTTP_HOST} !^localhost [NC]
#RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
- %{HTTP:X-Forwarded-Proto} !https für bessere SSL Erkennung
- [NC] bei !\.(.*)\. raus, da hier imho unnötig
comment:18 by , 9 years ago
Auch damit wird leider noch nicht http://www.example.com nach https://www.example.com weitergeleitet.
comment:19 by , 9 years ago
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
geht aber folgendes nicht?
RewriteCond %{HTTP_HOST} !^www\. [NC,OR]
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
comment:20 by , 9 years ago
Nein das gibt einen Umleitungsfehler für folgende Konstellationen:
http://example.com -> https://www.example.com
https://example.com -> https://www.example.com
follow-up: 22 comment:21 by , 9 years ago
Kurzer Hinweis: Alle X- Headerzeilen (auch oft bei Mails zu sehen) sind nicht vom RFC, sondern freiwillige Angaben irgendeines Systems. Sie haben keinerlei Standard und können superleicht gefaked werden.
comment:22 by , 9 years ago
Das war von mir. Hatte übersehen, das ich nicht eingeloggt bin. :D
Replying to anonymous:
Kurzer Hinweis: Alle X- Headerzeilen (auch oft bei Mails zu sehen) sind nicht vom RFC, sondern freiwillige Angaben irgendeines Systems. Sie haben keinerlei Standard und können superleicht gefaked werden.
comment:23 by , 9 years ago
h-h-h hat mir folgenden funktionierenden Code zugeschickt:
##-- redirect to http www-domain, when www is missing and no subdomain given and not using an ssl-proxy
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteCond %{HTTP_HOST} !\.(.*)\. [NC]
#RewriteCond %{HTTP_HOST} !^localhost [NC]
#RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
##-- redirect to https www-domain, when www is missing and no subdomain given and not using an ssl-proxy
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteCond %{HTTP_HOST} !\.(.*)\. [NC]
#RewriteCond %{HTTP_HOST} !^localhost [NC]
#RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#RewriteCond %{HTTPS} off
#RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
comment:25 by , 9 years ago
Sicher das dies die endgültige Lösung sein soll? Soweit ich das lese findet bei http://example.com erst eine Umleitung auf http://www.example.com (erster Block) und dann beim zweiten Aufruf der Seite wird http://www.example.com umgeleitet zu https://www.example.com
comment:26 by , 9 years ago
Google PageSpeed meckert mir zumindest keine doppelte Weiterleitung mehr an. Es scheint also so zu funktionieren wie gedacht.
Es wäre super, wenn das nochmal jemand anders testen würde.
comment:27 by , 9 years ago
@cYbercOsmOnauT: Es wird entweder der erste oder der zweite Block genutzt.
comment:28 by , 9 years ago
Achso... entweder der Block für Leute ohne HTTPS oder der zweite.. okay, macht Sinn.
comment:29 by , 9 years ago
probiert mal mit der lösung von h-h-h bei einer aufgerufner https: url das www weg zu löschen...
gruss
umbi
comment:30 by , 9 years ago
Dann passiert was? Es wird wieder auf www weitergeleitet, aber das ist ja auch genau Sinn der Sache um duplicate content zu verhindern.
comment:31 by , 9 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
comment:32 by , 9 years ago
Ich hatte jetzt mit diesem Code bei zwei Providern unendliche Redirects
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Bei Provider A hat diese Lösung funknioniert
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Bei Provider B diese Lösung
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
Deshalb sollte das in die htaccess
RewriteCond %{HTTPS} off
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
So ist es auch hier vorgeschlagen: Redirect HTTP to HTTPS
comment:33 by , 9 years ago
Das kann ich bestätigen!
Ich hatte neulich auch den Fall, dass die Bedingung nicht funktionierte:
RewriteCond %{HTTPS} off
Damit lief es dann aber:
RewriteCond %{SERVER_PORT} !=443
comment:34 by , 9 years ago
| Milestone: | modified-shop-2.0.1.0 → modified-shop-2.0.2.2 |
|---|
follow-up: 38 comment:36 by , 9 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
es darf auf keinen Fall ein [OR] bei den Regeln sein, das gibt dann wieder Redirects
Außerdem sollten wir überlegen eine Regel für ein Verzeichnisasuschluss hinzuzufügen
comment:38 by , 9 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
Replying to web28:
[...]
Außerdem sollten wir überlegen eine Regel für ein Verzeichnisasuschluss hinzuzufügen
Ich habe das Ticket diesbezüglich nochmal geöffnet.
comment:39 by , 9 years ago
Die Weiterleitungen für https non-www-domain funktionieren noch nicht korrekt.
Weitergeleitet werden soll ja:
https://www.example.com -> https://example.com
http://www.example.com -> https://example.com
http://example.com -> https://example.com
Das hat hiermit funktioniert:
##-- redirect to https non-www-domain, when no subdomain given and not using an ssl-proxy
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
Bzw. bei manchen problematischen Servern (teilweise all-inkl.com & Strato) dann mit:
##-- redirect to https non-www-domain, when no subdomain given and not using an ssl-proxy
RewriteCond %{SERVER_PORT} !^443$ [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
Was aber nicht funktioniert ist:
##-- redirect to https non-www-domain, when no subdomain given and not using an ssl-proxy
RewriteCond %{HTTPS} off
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
RewriteRule ^ https://%1%{REQUEST_URI} [L,NE,R=301]
Hier funktionieren dann die folgenden Weiterleitungen nicht:
https://www.example.com -> https://example.com
http://example.com -> https://example.com
Funktionieren tut aber:
http://www.example.com -> https://example.com
Da fehlt noch irgendwo das [OR] an einer oder mehreren Stellen.
comment:40 by , 9 years ago
Ich habe nun bei verschiedenen Hostern getestet.
Das funktioniert bei Strato überhaupt nicht:
RewriteCond %{HTTPS} off
Das funktioniert auch bei vielen anderen Server überhaupt nicht:
RewriteCond %{HTTP:X-Forwarded-Proto} !https
Bleibt eigentlich nur noch (funktioniert bei allen):
RewriteCond %{SERVER_PORT} !^443$
comment:42 by , 9 years ago
Bei meinem Provider funktioniert nur
RewriteCond %{HTTP:X-Forwarded-Proto} !https
Deshalb auch der Vorschlag alle 3 Varianten in die Datei aufzunehmen mit einem Hinweistext das man es ausprobieren muss. Es gibt keine Lösung die überall funktioniert.
comment:45 by , 9 years ago
Das blöde ist, dass man in der .htaccess kein Inline-Kommentare verwenden darf, wobei es wohl geht, sofern vorher ein flag steht.
Der Code wird dadurch ziemlich lang und unübersichtlich:
##-- redirect to https www-domain, when www is missing and no subdomain given and not using an ssl-proxy
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteCond %{HTTP_HOST} !\.(.*)\. [NC]
#RewriteCond %{HTTP_HOST} !^localhost [NC]
#RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
##-- ATTENTION: Use only one of the following RewriteCond lines!
##-- Works on most servers
#RewriteCond %{SERVER_PORT} !^443$
##-- Try this line if you encounter problems
#RewriteCond %{HTTPS} off
##-- This line is for special hoster like velogrid.com
RewriteCond %{HTTP:X-Forwarded-Proto} !https
#RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
##-- redirect to https non-www-domain, when no subdomain given and not using an ssl-proxy
##-- ATTENTION: Use only one of the following RewriteCond lines!
##-- Works on most servers
#RewriteCond %{SERVER_PORT} !^443$ [OR]
##-- Try this line if you encounter problems
#RewriteCond %{HTTPS} off
##-- This line is for special hoster like velogrid.com
RewriteCond %{HTTP:X-Forwarded-Proto} !https
#RewriteCond %{HTTP_HOST} ^www\. [NC]
#RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
#RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
Kannst du bitte mal hiermit testen?
##-- redirect to https www-domain, when www is missing and no subdomain given and not using an ssl-proxy
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteCond %{HTTP_HOST} !\.(.*)\. [NC]
#RewriteCond %{HTTP_HOST} !^localhost [NC]
#RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
#RewriteCond %{SERVER_PORT} 80
#RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
##-- redirect to https non-www-domain, when no subdomain given and not using an ssl-proxy
#RewriteCond %{SERVER_PORT} 80 [OR]
#RewriteCond %{HTTP_HOST} ^www\. [NC]
#RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
#RewriteRule ^ https://%1%{REQUEST_URI} [R=301,L]
comment:46 by , 9 years ago
Und lassen sich die beiden Zeilen hier nicht noch zu einer zusammen fassen?
Aus dem hier:
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteCond %{HTTP_HOST} ^(?:www\.)?(.+)$ [NC]
Wird das:
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
follow-up: 49 comment:47 by , 9 years ago
Man sollte statt der vielen Kommetare auf z. B. eine Seite im WIKI verweisen, wo das alles beschrieben und erklärt wird.
comment:49 by , 9 years ago
okay, dann machen wir das wie von dir vorgeschlagen:
Replying to web28:
Man sollte statt der vielen Kommetare auf z. B. eine Seite im WIKI verweisen, wo das alles beschrieben und erklärt wird.
Hast du eine Idee für den Titel der Wiki-Seite? Einfach nur ".htaccess Weiterleitungen"?
comment:50 by , 9 years ago
| Milestone: | modified-shop-2.0.2.2 → modified-shop-2.0.2.3 |
|---|---|
| Resolution: | fixed |
| Status: | closed → reopened |
Ich öffne das Thema nochmal, da ich noch weitere Ideen habe.
Zum einen:
#-- remove double slashes
#RewriteCond %{REQUEST_URI} ^(.*)//(.*)$
#RewriteRule . %1/%2 [R=301,L]
#-- prevent duplicate index of root domain (doesn't work if shop is in subfolder of domain)
#RewriteCond %{HTTP_HOST} !^\/$
#RewriteRule ^$ /index.php [R=301,L]
Zum anderen hier: The ultimate .htaccess file. Please feel free to fork it, edit it and let me know what do you think about it.
Speziell dort der Teil:
## Prevent use of specified methods in HTTP Request
#
RewriteCond %{REQUEST_METHOD} ^(HEAD|TRACE|DELETE|TRACK) [NC,OR]
#
## Block out use of illegal or unsafe characters in the HTTP Request
#
RewriteCond %{THE_REQUEST} ^.*(\\r|\\n|%0A|%0D).* [NC,OR]
#
## Block out use of illegal or unsafe characters in the Referer Variable of the HTTP Request
## RewriteCond %{HTTP_REFERER} ^(.*)(<|>|'|'|%0A|%0D|%27|%3C|%3E|%00).* [NC,OR]
## Block out use of illegal or unsafe characters in any cookie associated with the HTTP Request
#
RewriteCond %{HTTP_COOKIE} ^.*(<|>|'|'|%0A|%0D|%27|%3C|%3E|%00).* [NC,OR]
#
## Block out use of illegal characters in URI or use of malformed URI
#
RewriteCond %{REQUEST_URI} ^/(,|;|:|<|>|">|"<|/|\\\.\.\\).{0,9999}.* [NC,OR]
#
## Block out use of empty User Agent Strings
## NOTE - disable this rule if your site is integrated with Payment Gateways such as PayPal
## RewriteCond %{HTTP_USER_AGENT} ^$ [OR]
## Block out use of illegal or unsafe characters in the User Agent variable
#
RewriteCond %{HTTP_USER_AGENT} ^.*(<|>|'|'|%0A|%0D|%27|%3C|%3E|%00).* [NC,OR]
#
## Measures to block out SQL injection attacks
#
RewriteCond %{QUERY_STRING} ^.*(;|<|>|'|"|"|'|\)|%0A|%0D|%22|%27|%3C|%3E|%00).*(/\*|union|select|insert|cast|set|declare|drop|update|md5|benchmark).* [NC,OR]
#
## Block out reference to localhost/loopback/127.0.0.1 in the Query String
#
RewriteCond %{QUERY_STRING} ^.*(localhost|loopback|127\.0\.0\.1).* [NC,OR]
#
## Block out use of illegal or unsafe characters in the Query String variable
#
RewriteCond %{QUERY_STRING} ^.*(<|>|'|'|%0A|%0D|%27|%3C|%3E|%00).* [NC]
#
########## Begin - File injection protection, by SigSiu.net
RewriteCond %{REQUEST_METHOD} GET
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http:// [OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=(\.\.//?)+ [OR]
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=/([a-z0-9_.]//?)+ [NC]
RewriteRule .* - [F]
########## End - File injection protection
#
RewriteCond %{QUERY_STRING} [a-zA-Z0-9_]=http%3A%2F%2F [OR]
#
# proc/self/environ? no way!
#
RewriteCond %{QUERY_STRING} proc\/self\/environ [NC,OR]
#
## PHP-CGI Vulnerability
#
RewriteCond %{QUERY_STRING} ^(%2d|\-)[^=]+$ [NC]
RewriteRule (.*) - [F,L]
comment:51 by , 9 years ago
| Milestone: | modified-shop-2.0.2.3 → modified-shop-2.0.2.4 |
|---|
comment:52 by , 8 years ago
Neben dem Link "The ultimate .htaccess file. Please feel free to fork it, edit it and let me know what do you think about it." ist das hier auch noch interessant:
The-Perfect-Apache-Configuration
comment:53 by , 8 years ago
| Milestone: | modified-shop-2.0.4.0 |
|---|

#RewriteCond %{HTTP_HOST} !^www\. [NC] #RewriteCond %{HTTP_HOST} !\.(.*)\. [NC] #RewriteCond %{HTTP_HOST} !^localhost [NC] #RewriteRule (.*) http://www.%{HTTP_HOST}/$1 [R=301,L] ##-- ensure www. #RewriteCond %{HTTP_HOST} !^www\. [NC] #RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L] ##-- ensure https #RewriteCond %{HTTPS} off #RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]Bei ensure www. fehlt meiner Meinung nach die Condition für https Umleitung als Oder Verknüpfung
Also so:
##-- ensure www. #RewriteCond %{HTTPS} off [OR] #RewriteCond %{HTTP_HOST} !^www\. [NC] #RewriteRule ^ https://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]Das müsste meiner Meinung nach jeweils auch noch rein, damit das auch unter localhost funktioniert:
#RewriteCond %{HTTP_HOST} !^localhost [NC]Frage ist ob man diese Umleitungsregeln nicht in PHP machen sollte, dann könnte man das über das Backend nach Wunsch konfigurieren