Ergebnis 1 bis 2 von 2

Thema: htaccess Weiterleitung von /gutschein auf /gutschein.html

  1. #1
    Contao-Fan Avatar von Bas
    Registriert seit
    03.12.2009.
    Ort
    Hamburg
    Beiträge
    555

    Standard htaccess Weiterleitung von /gutschein auf /gutschein.html

    Hallo,

    ich brauch bitte htaccess-Hilfe.
    Auf einem gedruckten Gutschein wird folgende URL kommuniziert: domain.de/gutschein
    Die URL wo man hinsoll lautet allerdings https://domain.de/gutschein.html
    Ich möchte also einen entsprechenden Rewrite in meiner htaccess hinzufügen.
    Innerhalb meiner htaccess habe ich bereits die Umleitung von http auf https integriert (die auch funktioniert).

    Hier meine htaccess ... mit dieser erhalte ich aktuell bei Aufruf von domain.de/gutschein den Fehler "to many redirects".

    Danke für Hilfe.

    Code:
    <IfModule mod_headers.c>
        # Allow access from all domains for webfonts (see contao/core-bundle#528)
        <FilesMatch "\.(ttf|ttc|otf|eot|woff2?|font\.css)$">
            Header set Access-Control-Allow-Origin "*"
        </FilesMatch>
    </IfModule>
    
    <IfModule mod_rewrite.c>
        RewriteEngine On
    
        RewriteCond %{HTTPS} off
        RewriteRule (.*) https://domain.de/$1 [L,R=301]
    
        RewriteCond %{HTTP_HOST} ^domain\.de$ [NC]
        RewriteRule ^gutschein /gutschein.html [R=301,L]
    
        # Determine the RewriteBase automatically and set it as environment variable.
        # If you are using Apache aliases to do mass virtual hosting or installed the
        # project in a subdirectory, the base path will be prepended to allow proper
        # resolution of the app.php file and to redirect to the correct URI. It will
        # work in environments without path prefix as well, providing a safe, one-size
        # fits all solution. But as you do not need it in this case, you can comment
        # the following 2 lines to eliminate the overhead.
        RewriteCond %{REQUEST_URI}::$1 ^(/.+)/(.*)::\2$
        RewriteRule ^(.*) - [E=BASE:%1]
    [...gekürzt...]

  2. #2
    Community-Moderator
    Wandelndes Contao-Lexikon
    Avatar von Spooky
    Registriert seit
    12.04.2012.
    Ort
    Scotland
    Beiträge
    34.063
    Partner-ID
    10107

    Standard

    Du hast ein $ vergessen.

    Allerdings brauchst du dafür nicht gleich die Rewrite Engine. Das hier reicht auch:
    Code:
    RedirectMatch 301 ^gutschein$ https://example.org/gutschein.html

Aktive Benutzer

Aktive Benutzer

Aktive Benutzer in diesem Thema: 1 (Registrierte Benutzer: 0, Gäste: 1)

Lesezeichen

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •