Ergebnis 1 bis 5 von 5

Thema: Sprachen / prepend_locale: true erzeugt Fehler" too many redirects"

  1. #1
    Contao-Fan
    Registriert seit
    28.02.2011.
    Beiträge
    720

    Standard Sprachen / prepend_locale: true erzeugt Fehler" too many redirects"

    Hallo zusammen,

    ich habe gerade ein Problem die Mehrsprachigkeit zu aktivieren.
    Es ist soweit alles vorgereitet, aber wenn ich "prepend_locale: true" in parameters.yml setze, kriege ich beim Aufrufen der Website den Fehler" too many redirects".

    php vendor/bin/contao-console cache:clear
    php vendor/bin/contao-console cache:warmup --env prod
    und Browsercache leeren habe ich gemacht.

    Woran kann das liegen?

    Viele Grüße,
    conter

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

    Standard

    Poste deine web/.htaccess

  3. #3
    Contao-Fan
    Registriert seit
    28.02.2011.
    Beiträge
    720

    Standard

    Hallo,

    hier meine htaccess

    Viele Grüße,
    conter

    Code:
    ##htaccess 100
    <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>
    
    ### Test
    
    ##
    # Disable ETags
    # @see http://developer.yahoo.com/performance/rules.html#etags
    ##
    FileETag None
    <IfModule mod_headers.c>
      Header unset ETag
    </IfModule>
    
    ##
    # Set the proper MIME types
    # @see https://github.com/h5bp/html5-boilerplate
    ##
    <IfModule mod_mime.c>
      AddType application/javascript              js jsonp
      AddType application/json                    json
      AddType audio/ogg                           oga ogg
      AddType audio/mp4                           m4a f4a f4b
      AddType video/ogg                           ogv
      AddType video/mp4                           mp4 m4v f4v f4p
      AddType video/webm                          webm
      AddType video/x-flv                         flv
      AddType image/svg+xml                       svg svgz
      AddEncoding gzip                            svgz
      AddType application/vnd.ms-fontobject       eot
      AddType application/x-font-ttf              ttf ttc
      AddType font/opentype                       otf
      AddType application/x-font-woff             woff woff2
      AddType image/x-icon                        ico
      AddType image/webp                          webp
      AddType text/cache-manifest                 appcache manifest
      AddType text/x-component                    htc
      AddType application/xml                     rss atom xml rdf
      AddType application/x-web-app-manifest+json webapp
      AddType text/x-vcard                        vcf
      AddType application/x-shockwave-flash       swf
    </IfModule>
    
    ##
    # Gzip compression
    # @see https://github.com/h5bp/html5-boilerplate
    ##
    <IfModule mod_deflate.c>
      <IfModule mod_filter.c>
        AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
        AddOutputFilterByType DEFLATE application/javascript
        AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
        AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
        AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
      </IfModule>
    </IfModule>
    
    
    AddEncoding gzip .gz
    <FilesMatch "\.js\.gz$">
    AddType "application/javascript" .gz
    </FilesMatch>
    <FilesMatch "\.css\.gz$">
    AddType "text/css" .gz
    </FilesMatch>
    RewriteCond %{HTTP:Accept-encoding} gzip
    RewriteCond %{REQUEST_FILENAME} \.(js|css)$
    RewriteCond %{REQUEST_FILENAME}.gz -f
    RewriteRule ^(.*)$ $1.gz [QSA,L]
    
    
    
    
    ##
    # Expires headers (for better cache control)
    # @see https://github.com/h5bp/html5-boilerplate
    ##
    <IfModule mod_expires.c>
      ExpiresActive on
    ##
    
    
      ExpiresDefault                                      "access plus 1 month"
    
    # CSS
    
      ExpiresByType text/css                              "access plus 1 year"
    
    
    # Data interchange
    
      ExpiresByType application/atom+xml                  "access plus 1 hour"
      ExpiresByType application/rdf+xml                   "access plus 1 hour"
      ExpiresByType application/rss+xml                   "access plus 1 hour"
    
      ExpiresByType application/json                      "access plus 0 seconds"
      ExpiresByType application/ld+json                   "access plus 0 seconds"
      ExpiresByType application/schema+json               "access plus 0 seconds"
      ExpiresByType application/vnd.geo+json              "access plus 0 seconds"
      ExpiresByType application/xml                       "access plus 0 seconds"
      ExpiresByType text/xml                              "access plus 0 seconds"
    
    
    # Favicon (cannot be renamed!) and cursor images
    
      ExpiresByType image/vnd.microsoft.icon              "access plus 1 week"
      ExpiresByType image/x-icon                          "access plus 1 week"
    
    # HTML
      ExpiresByType text/html                             "access plus 0 seconds"
    
    
    # JavaScript
    
      ExpiresByType application/javascript                "access plus 1 year"
      ExpiresByType application/x-javascript              "access plus 1 year"
      ExpiresByType text/javascript                       "access plus 1 year"
    
    
    # Manifest files
    
      ExpiresByType application/manifest+json             "access plus 1 week"
      ExpiresByType application/x-web-app-manifest+json   "access plus 0 seconds"
      ExpiresByType text/cache-manifest                   "access plus 0 seconds"
    
    
    # Media files
    
      ExpiresByType audio/ogg                             "access plus 3 month"
      ExpiresByType image/bmp                             "access plus 3 month"
      ExpiresByType image/gif                             "access plus 3 month"
      ExpiresByType image/jpeg                            "access plus 3 month"
      ExpiresByType image/png                             "access plus 3 month"
      ExpiresByType image/svg+xml                         "access plus 3 month"
      ExpiresByType image/webp                            "access plus 3 month"
      ExpiresByType video/mp4                             "access plus 3 month"
      ExpiresByType video/ogg                             "access plus 3 month"
      ExpiresByType video/webm                            "access plus 3 month"
    
    
    # Web fonts
    
      # Embedded OpenType (EOT)
      ExpiresByType application/vnd.ms-fontobject         "access plus 3 month"
      ExpiresByType font/eot                              "access plus 3 month"
    
      # OpenType
      ExpiresByType font/opentype                         "access plus 3 month"
    
      # TrueType
      ExpiresByType application/x-font-ttf                "access plus 3 month"
                                                                      
      # Web Open Font Format (WOFF) 1.0                               
      ExpiresByType application/font-woff                 "access plus 3 month"
      ExpiresByType application/x-font-woff               "access plus 3 month"
      ExpiresByType font/woff                             "access plus 3 month"
    
      # Web Open Font Format (WOFF) 2.0
      ExpiresByType application/font-woff2                "access plus 3 month"
    
    
    # Other
    
      ExpiresByType text/x-cross-domain-policy            "access plus 1 week"
    
    </IfModule>
    
    ##
    # Header adjustments
    ##
    <IfModule mod_headers.c>
    
      ##
      # Disable caching during development
      # @see https://github.com/contao/core/issues/4364
      ##
      #Header unset Cache-Control
      Header append Cache-Control must-revalidate
    
      ##
      # Do not cache the cron.txt file
      # @see https://github.com/contao/core/issues/5105
      ##
      <FilesMatch "cron\.txt$">
        Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform"
      </FilesMatch>
    
      ##
      # Add a Vary Accept-Encoding header for the compressed resources. If you
      # modify the file types above, make sure to change them here accordingly.
      # @see http://developer.yahoo.com/performance/rules.html#gzip
      #
      # 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:js|css|xml|gz|svgz)$">
      #
      # For more information see: https://github.com/contao/core/issues/4364
      ##
      <FilesMatch "\.(js|css|xml|gz|svgz)$">
        Header append Vary Accept-Encoding
      </FilesMatch>
    
      ##
      # Do not cache source map files
      # @see https://github.com/contao/core/issues/8532
      ##
      <FilesMatch "\.map$">
        Header set Expires "0"
        Header set Cache-Control "no-cache, no-store, must-revalidate, max-age=0, proxy-revalidate, no-transform"
      </FilesMatch>
    
    </IfModule>
    
    ##
    # Disable MultiViews if you are having issues with requests returning the wrong
    # page. Requires AllowOverride Options=All,MultiViews to be set here.
    # @see https://github.com/contao/core/issues/3521
    ##
    #Options -MultiViews
    
    <IfModule mod_rewrite.c>
        RewriteEngine On    
    
    
        # Remove traling slash in URL
        #RewriteCond %{REQUEST_FILENAME} !-d
        #RewriteRule ^(.+)/$ /$1 [NE,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]
    
        # Sets the HTTP_AUTHORIZATION header removed by Apache
        RewriteCond %{HTTP:Authorization} .
        RewriteRule ^ - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
     
        ##
        # Uncomment the following lines to add "www." to the domain:
        #
        RewriteCond %{HTTP_HOST} ^my-domain\.com$ [NC]
        RewriteRule (.*) https://www.my-domain.com/$1 [R=301,L]
        #
        # Uncomment the following lines to remove "www." from the domain:
        #
        #   RewriteCond %{HTTP_HOST} ^www\.example\.com$ [NC]
        #   RewriteRule (.*) http://example.com/$1 [R=301,L]
        #
        # Make sure to replace "example.com" with your domain name.
        ##
        # Kein Trailing Slash
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)/$ /$1 [R=301,NC,L]
        
        ##
        # If you cannot use mod_deflate, uncomment the following lines to load a
        # compressed .gz version of the aggregated Contao JavaScript and CSS files.
        ##
        #AddEncoding gzip .gz
        #<FilesMatch "\.js\.gz$">
        #  AddType "application/javascript" .gz
        #</FilesMatch>
        #<FilesMatch "\.css\.gz$">
        #  AddType "text/css" .gz
        #</FilesMatch>
        #RewriteCond %{HTTP:Accept-encoding} gzip
        #RewriteCond %{REQUEST_FILENAME} \.(js|css)$
        #RewriteCond %{REQUEST_FILENAME}.gz -f
        #RewriteRule ^(.*)$ $1.gz [QSA,L]
    
        # Redirect to URI without front controller to prevent duplicate content
        # (with and without `/app.php`). Only do this redirect on the initial
        # rewrite by Apache and not on subsequent cycles. Otherwise we would get an
        # endless redirect loop (request -> rewrite to front controller ->
        # redirect -> request -> ...).
        # So in case you get a "too many redirects" error or you always get redirected
        # to the start page because your Apache does not expose the REDIRECT_STATUS
        # environment variable, you have 2 choices:
        # - disable this feature by commenting the following 2 lines or
        # - use Apache >= 2.3.9 and replace all L flags by END flags and remove the
        #   following RewriteCond (best solution)
        RewriteCond %{ENV:REDIRECT_STATUS} ^$
        RewriteRule ^app\.php(?:/(.*)|$) %{ENV:BASE}/$1 [R=301,L]
    
        # If the requested filename exists, simply serve it.
        # We only want to let Apache serve files and not directories.
        RewriteCond %{REQUEST_FILENAME} -f
        RewriteRule ^ - [L]
    
        # Rewrite all other queries to the front controller.
        RewriteRule ^ %{ENV:BASE}/app.php [L]
            
        #alte Seiten umleiten
        Redirect 301 /searchout /suchergebnisse
        Redirect 301 /news/aktuell /news
        Redirect 301 /news/gallerie /news
        Redirect 301 /unternehmen/auszeichnungen /ueber-uns
        Redirect 301 /news/newsletter /newsletter
        Redirect 301 /loesungen/luftfahrt /luftfahrt
        Redirect 301 /unternehmen/historie /ueber-uns
        Redirect 301 /technologien/visiontechnik /visiontechnik
        Redirect 301 /technologien/cfk /cfk-bearbeitung
        Redirect 301 /unternehmen/karriere /karriere
        Redirect 301 /unternehmen/standorte /standorte
        Redirect 301 /unternehmen/forschungsprojekte /forschung
        Redirect 301 /news/newssingle /news
        Redirect 301 /unternehmen/partner /unternehmen
        Redirect 301 /technologien/software /software
        Redirect 301 /technologien/schaltschrankbau /schaltschrankbau
        Redirect 301 /loginarea/login /
        Redirect 301 /technologien/robotertechnik /robotertechnik
        Redirect 301 /imprint/datenschutz.html /datenschutz
        Redirect 301 /unternehmen/forschungsprojekte/3dprocar /forschungsprojekte/3dprocar
        Redirect 301 /technologien/greifsysteme/catalogsearch /greifsysteme
        Redirect 301 /unternehmen/forschungsprojekte/streetscooter /forschungsprojekte/streetscooter
        Redirect 301 /unternehmen/forschungsprojekte/kmuproductionnet /forschung
        Redirect 301 /unternehmen/karriere/studium /karriere
        Redirect 301 /loesungen/green-technology /green-technology
        Redirect 301 /unternehmen/forschungsprojekte/conexing /forschungsprojekte/conexing
        Redirect 301 /imprint/impressum.html /impressum
        Redirect 301 /loesungen/automotive/sitzschienenmontage /sitzschienenmontage
        Redirect 301 /unternehmen/karriere/abschlussarbeiten /karriere
        Redirect 301 /loesungen/automotive/sicherungsringmontage /sicherungsringmontage
        Redirect 301 /unternehmen/forschungsprojekte/iprocell /forschungsprojekte/iprocell
        Redirect 301 /news/pressemeldung-29052016 /news
        Redirect 301 /news/robotics-kongress /news
        Redirect 301 /loesungen/automotive/schiebedacheinbau /schiebedachmontage
        Redirect 301 /unternehmen/forschungsprojekte/automok /forschungsprojekte/automok
        Redirect 301 /news/robot-wars /news
        Redirect 301 /loesungen/logistik/agv /agv-automated-guided-vehicle
        Redirect 301 /unternehmen/forschungsprojekte/senrobgrip /forschungsprojekte/senrobgrip
        Redirect 301 /news/messetermine/uebersicht /news
        Redirect 301 /technologien/greifsysteme/greifsysteme /greifsysteme
        Redirect 301 /unternehmen/.../cybersystemconnector /forschungsprojekte/cybersystemconnector
        Redirect 301 /loesungen/automotive/kurbelwellenmessung /automotive
        Redirect 301 /loesungen/automotive/wuchtanlagen /wuchtanlage
        Redirect 301 /news/nortec-2016 /news
    
    
    
    </IfModule>
    
    <IfModule !mod_rewrite.c>
        <IfModule mod_alias.c>
            # When mod_rewrite is not available, we instruct a temporary redirect of
            # the start page to the front controller explicitly so that the website
            # and the generated links can still be used.
            RedirectMatch 302 ^/$ /app.php/
            # RedirectTemp cannot be used instead
        </IfModule>
    </IfModule>
    
    ###test Ende

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

    Standard

    Das Problem wird vermutlich durch
    Code:
        # Kein Trailing Slash
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule ^(.*)/$ /$1 [R=301,NC,L]
    verursacht.

  5. #5
    Contao-Fan
    Registriert seit
    28.02.2011.
    Beiträge
    720

    Standard

    Das war der Übeltäter, jetzt funktioniert alles!

    Vielen Dank für deine Hilfe!
    Geändert von conter (04.04.2019 um 14:17 Uhr)

Aktive Benutzer

Aktive Benutzer

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

Berechtigungen

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