Ergebnis 1 bis 5 von 5

Thema: Richtige Einstellung in htaccess

  1. #1
    Contao-Nutzer
    Registriert seit
    05.11.2009.
    Beiträge
    166

    Standard Richtige Einstellung in htaccess

    Meine URL-Suffix soll ".htm statt html sein. Ich habe in Contao 3.1 den Browser und den Servercache aktiviert.

    Welche URL-Rewirte Regel gilt nun. Die neue htaccess ist etwas verwirrend:

    Code:
    # By default, Contao adds ".html" to the generated URLs to simulate static
      # HTML documents. If you change the URL suffix in the back end settings, make
      # sure to change it here accordingly!
      #
      #   RewriteRule .*\.htm$ index.php [L]   # URL suffix .htm
      #   RewriteRule .*\.txt$ index.php [L]    # URL suffix .txt
      #   RewriteRule .*\.json$ index.php [L]   # URL suffix .json
      #
      # If you do not want to use an URL suffix at all, you have to add a second
      # line to prevent URLs that point to folders from being rewritten (see #4031).
      #
      #   RewriteCond %{REQUEST_FILENAME} !-d
      #   RewriteRule .* index.php [L]
      #
      # If you are using mod_cache, it is recommended to use the RewriteRule below,
      # which adds the query string to the internal URL:
      #
      RewriteRule (.*\.html)$ index.php/$1 [L]
      #
      # Note that not all environments support mod_rewrite and mod_cache.
      ##
      RewriteCond %{REQUEST_FILENAME} !-f
      # RewriteRule .*\.htm$ index.php [L]
    
      ##
      # The following rules are required if you want to pass the language as first
      # URL parameter (added in Contao 2.11). The first rule rewrites an empty URL
      # to the front end controller, the second one adds a missing trailing slash.
      ##
      RewriteRule ^[a-z]{2}(\-[A-Z]{2})?/$ index.php [L]
      RewriteRule ^([a-z]{2}(\-[A-Z]{2})?)$ $1/ [R=301,L]
    
    </IfModule>

  2. #2
    Administrator Avatar von xchs
    Registriert seit
    19.06.2009.
    Beiträge
    14.559
    User beschenken
    Wunschliste
    Contao-Projekt unterstützen

    Support Contao

    Standard

    Der betreffende Abschnitt sollte wie folgt aussehen:
    Code:
      ##
      # By default, Contao adds ".html" to the generated URLs to simulate static
      # HTML documents. If you change the URL suffix in the back end settings, make
      # sure to change it here accordingly!
      #
      #   RewriteRule .*\.html$ index.php [L]   # URL suffix .html
      #   RewriteRule .*\.txt$ index.php [L]    # URL suffix .txt
      #   RewriteRule .*\.json$ index.php [L]   # URL suffix .json
      #
      # If you do not want to use an URL suffix at all, you have to add a second
      # line to prevent URLs that point to folders from being rewritten (see #4031).
      #
      #   RewriteCond %{REQUEST_FILENAME} !-d
      #   RewriteRule .* index.php [L]
      #
      # If you are using mod_cache, it is recommended to use the RewriteRule below,
      # which adds the query string to the internal URL:
      #
      #   RewriteRule (.*\.html)$ index.php/$1 [L]
      #
      # Note that not all environments support mod_rewrite and mod_cache.
      ##
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule .*\.htm$ index.php [L]
    Zusätzlich musst Du in den "Einstellungen" unter "Frontend-Einstellungen" den "URL-Suffix" von ".html" auf ".htm" ändern.
    Contao Community Administrator

    [Unterstützungsmöglichkeiten]

  3. #3
    Contao-Nutzer
    Registriert seit
    05.11.2009.
    Beiträge
    166

    Standard

    Genau so hab ich es eingestellt; geht aber trotzdem nicht. Kann das daran liegen, dass die Installation in einer Subdomain liegt? (war aber bei der alten htaccess und einer 2er Installation auch so und funktioniert ohne weitere Einstellungen)

    Code:
    # Note that not all environments support mod_rewrite and mod_cache.
      ##
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule .*\.htm$ index.php [L]
    
      ##
      # The following rules are required if you want to pass the language as first
      # URL parameter (added in Contao 2.11). The first rule rewrites an empty URL
      # to the front end controller, the second one adds a missing trailing slash.
      ##
      RewriteRule ^[a-z]{2}(\-[A-Z]{2})?/$ index.php [L]
      RewriteRule ^([a-z]{2}(\-[A-Z]{2})?)$ $1/ [R=301,L]
    
    </IfModule>

  4. #4
    Administrator Avatar von xchs
    Registriert seit
    19.06.2009.
    Beiträge
    14.559
    User beschenken
    Wunschliste
    Contao-Projekt unterstützen

    Support Contao

    Standard

    Du musst hier aus der FilesMatch-Direktive die Endung (bei Dir also ".htm") entfernen:
    Code:
      ##
      # Do not rewrite requests for static files or folders such as style sheets,
      # images, movies or text documents. Do not add the URL suffix here!
      #
      # Note: If you are using a case-sensitive file system like HFS+ or ext4, you
      # have to change the <FilesMatch> directive as follows:
      #
      # <FilesMatch "\.(?i:htm|php|js|css| … |gz)$">
      #
      # For more information see: https://github.com/contao/core/issues/4364
      ##
      <FilesMatch "\.(htm|php|js|css|htc|png|gif|jpe?g|ico|xml|csv|txt|swf|flv|mp4|webm|ogv|mp3|ogg|oga|eot|woff|svg|svgz|ttf|pdf|gz)$">
        RewriteEngine Off
      </FilesMatch>
    Andernfalls würde sonst die RewriteEngine für diesen Suffix abgeschaltet.
    Contao Community Administrator

    [Unterstützungsmöglichkeiten]

  5. #5
    Contao-Nutzer
    Registriert seit
    05.11.2009.
    Beiträge
    166

    Standard Das war's!

    Besten Dank!

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
  •