AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Zurück Delphi-PRAXiS Delphi-PRAXiS - Lounge Klatsch und Tratsch .htaccess: Problem bei Rewrite Conditions

.htaccess: Problem bei Rewrite Conditions

Ein Thema von amigage · begonnen am 9. Mär 2017 · letzter Beitrag vom 9. Mär 2017
Antwort Antwort
amigage

Registriert seit: 11. Nov 2005
Ort: Leipzig
270 Beiträge
 
Delphi 11 Alexandria
 
#1

.htaccess: Problem bei Rewrite Conditions

  Alt 9. Mär 2017, 10:31
Hallo,

ich habe ein Problem mit meiner Rewrite Konfiguration.
zunächst möchte ich alle http:// Aufrufe nach https:// umleiten.
Das ist soweit kein Problem:

Code:
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
Nun möchte ich aber, dass eine bestimmte php-Datei - sagen wir special.php - NICHT umgeleitet werden soll.

Code:
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteCond %{REQUEST_URI} !(.*)special(.*)
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
Leider funktioniert das nicht. Es wird trotzdem auch die special.php auf https:// umgeleitet.
Kann mir jemand erklären, warum?

Besten Dank
amigage

Geändert von amigage ( 9. Mär 2017 um 10:35 Uhr)
  Mit Zitat antworten Zitat
Klaus01

Registriert seit: 30. Nov 2005
Ort: München
5.753 Beiträge
 
Delphi 10.4 Sydney
 
#2

AW: .htaccess: Problem bei Rewrite Conditions

  Alt 9. Mär 2017, 10:37
.. ist die Antwort vielleicht hier zu finden?

Grüße
Klaus
Klaus
  Mit Zitat antworten Zitat
amigage

Registriert seit: 11. Nov 2005
Ort: Leipzig
270 Beiträge
 
Delphi 11 Alexandria
 
#3

AW: .htaccess: Problem bei Rewrite Conditions

  Alt 9. Mär 2017, 12:42
Vielen Dank für den Link.

Die Lösung ist simpel:
Delphi-Quellcode:
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTPS} off
  RewriteCond %{REQUEST_URI} !special\.php
  RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</IfModule>
Das Problem war, dass mein Browser aufgrund von R=302 die Aufrufe gecached hat und somit den http Aufruf immer auf https umgeleitet hat.

Der Hinweis unter http://stackoverflow.com/questions/7...rewrite-script hat mich zum Ziel geführt.

Zitat:
If you need to do 301 (permanent) redirects -- do 302 instead during a testing period (until you are happy with the rule and results -- then change to 301) as modern browsers do cache 301 redirects .. so you may end up in frustrating situation when you have completely changed the rule (or even deleted it) but browser still do redirects. The only cure in such case -- clear browser cache and restart.
  Mit Zitat antworten Zitat
Themen-Optionen Thema durchsuchen
Thema durchsuchen:

Erweiterte Suche
Ansicht

Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 07:35 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz