Ergebnis 1 bis 9 von 9

Thema: htaccess - URL ohne Suffix - Verzeichnisse werden nicht erkannt

  1. #1
    Contao-Fan Avatar von Ainschy
    Registriert seit
    24.06.2009.
    Ort
    Wenden
    Beiträge
    796
    Partner-ID
    5666
    User beschenken
    Wunschliste
    Contao-Projekt unterstützen

    Support Contao

    Fehler htaccess - URL ohne Suffix - Verzeichnisse werden nicht erkannt

    Die neue htaccess, welche ab 3.2 mitgeliefert wird macht Probleme bei der Verwendung von:

    Code:
     # 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]
     #
    Die Verzeichnisse werden nicht mehr erkannt.

    In 3.2 wurde der Block:

    Code:
      # 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|ttf|pdf|gz)$">
        RewriteEngine Off
      </FilesMatch>
    entfernt und weiter unten hinzugefügt

    Code:
      # Note that not all environments support mod_rewrite and mod_cache.  ##
      RewriteCond %{REQUEST_FILENAME} !\.(htm|php|js|css|htc|png|gif|jpe?g|ico|xml|csv|txt|swf|flv|mp4|webm|ogv|mp3|ogg|oga|eot|otf|tt[cf]|woff|svg|svgz|pdf|gz)$
    ....
    ändere ich die htaccess wieder wie sie bei 3.1 war funktionierts.

  2. #2
    Contao-Urgestein Avatar von KlausGrenoble
    Registriert seit
    27.01.2013.
    Ort
    Grenoble
    Beiträge
    2.362

    Standard

    Bin mir nicht sicher, aber hat vielleicht hiermit was zu tun oder hilft zumindest weiter:
    https://community.contao.org/de/show...html-und-hallo

  3. #3
    Contao-Fan Avatar von Ainschy
    Registriert seit
    24.06.2009.
    Ort
    Wenden
    Beiträge
    796
    Partner-ID
    5666
    User beschenken
    Wunschliste
    Contao-Projekt unterstützen

    Support Contao

    Standard

    Hat mit dem Thema nur bedingt was zu tun.

    Das Problem: Die Verzeichnisse werden als solche nicht mehr erkannt. Du kommst mit den aktuellen Einstellung nicht mal mehr ins Backend.
    Wenn wie beschrieben der URL Suffix in den Einstellungen gelöscht und die entsprechenden zwei Zeilen aktiviert sind.

    vg Oliver

  4. #4
    Contao-Fan Avatar von Zero
    Registriert seit
    25.05.2010.
    Ort
    Korntal
    Beiträge
    520
    User beschenken
    Wunschliste

    Standard

    Verstehe ich richtig, dass du versuchst Folder Urls zu verwenden?

    Mein htaccess sieht am Ende so aus:
    Code:
    # Note that not all environments support mod_rewrite and mod_cache.
      ##
      RewriteCond %{REQUEST_FILENAME} !\.(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)$
      # add a trailing slash
      RewriteRule (.*[^/])$ $1/ [R=301,L]
    
      RewriteCond %{REQUEST_FILENAME} !\.(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)$
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule .* 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 the 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]
    Als URL suffix habe ich den slash angegeben. Das war das einfachste nach endlosem rumprobieren...
    PHP-Code:
    $GLOBALS['TL_CONFIG']['urlSuffix'] = '/'
    Mein Blog -> brothers-project.de

  5. #5
    Contao-Fan Avatar von Ainschy
    Registriert seit
    24.06.2009.
    Ort
    Wenden
    Beiträge
    796
    Partner-ID
    5666
    User beschenken
    Wunschliste
    Contao-Projekt unterstützen

    Support Contao

    Frage

    So sieht meine htaccess ab Zeile ca. 250 aus.

    Code:
      
      <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>
      
      ##
      # 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 .*\.html$ 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]
    Damit lassen sich bei All-inkl. sowohl Folder-URL als auch die Seite ohne URL Suffix betreiben und auch das Backend funzt wie gewohnt.

    Wenn ich stattdessen die htacces ab 3.2 verwende, hier ab Zeile 240

    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} !\.(htm|php|js|css|htc|png|gif|jpe?g|ico|xml|csv|txt|swf|flv|mp4|webm|ogv|mp3|ogg|oga|eot|otf|tt[cf]|woff|svg|svgz|pdf|gz)$
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule .*\.html$ 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 the 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]
    werden alle realen Verzeichnisse nicht mehr gefunden und Contao versucht diese als folderurl Parameter zu interpretieren.

    Kann das jemand bestätigen? Wie sieht das bei anderen Hostern aus?

    Ich habe zwei Testinstallationen bei All-inkl. eingerichtet (eine 3.2.12 und eine 3.3.3) und komme jeweils zum selber Ergebnis.
    Geändert von Ainschy (30.07.2014 um 08:24 Uhr)

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

    Standard

    @Ainschy: du darfst die entsprechenden Zeilen nicht einfach einkommentieren sondern musst sie an die richtige Stelle kopieren bzw. überschreiben. Wenn du kein URL Suffix verwendest werden diese Zeilen im Original:
    Code:
      RewriteCond %{REQUEST_FILENAME} !\.(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)$
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteRule .*\.html$ index.php [L]
    so umgeschrieben:
    Code:
      RewriteCond %{REQUEST_FILENAME} !\.(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)$
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule .* index.php [L]

  7. #7
    Contao-Fan Avatar von Ainschy
    Registriert seit
    24.06.2009.
    Ort
    Wenden
    Beiträge
    796
    Partner-ID
    5666
    User beschenken
    Wunschliste
    Contao-Projekt unterstützen

    Support Contao

    Standard Danke Spooky

    Stimmt, da hast du absolut Recht. Ich war so auf die htaccess < 3.2 eingestellt, das ich das nahe liegende nicht zusammen bekam.

    ggf. sollte dann der Hinweis in der htacces >3.1 angepasst werden?


    vg Oliver

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

    Standard

    Zitat Zitat von Ainschy Beitrag anzeigen
    ggf. sollte dann der Hinweis in der htacces >3.1 angepasst werden?
    agreed https://github.com/contao/core/issues/7216

    Oder meinst du einen anderen Hinweis?

  9. #9
    Contao-Fan Avatar von Ainschy
    Registriert seit
    24.06.2009.
    Ort
    Wenden
    Beiträge
    796
    Partner-ID
    5666
    User beschenken
    Wunschliste
    Contao-Projekt unterstützen

    Support Contao

    Standard

    Ja, genau den meine ich.

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
  •