Contao-Camp 2024
Ergebnis 1 bis 14 von 14

Thema: Mit Update online gehen: Welche Einträge in die .htaccess

  1. #1
    Contao-Fan
    Registriert seit
    05.11.2012.
    Beiträge
    400

    Standard Mit Update online gehen: Welche Einträge in die .htaccess

    Hallo,

    ich möchte am WE mit einer neuen Website online gehen, die ich in Contao 4.5 aufgebaut habe.
    Nun wird ja leider keine vorkonfigurierte .htaccess-Datei mehr bei der Installation angelegt.

    Daher nun meine Frage: Welche Einträge muss eine funktionierende .htaccess-Datei aufweisen (Webhoster ist All-inkl., falls das wichtig ist)?

    Ich möchte auf jeden Fall von mit www. auf ohne umstellen.
    Habt Ihr noch Empfehlungen, was auf jeden Fall eingetragen werden sollte?

    In kürze wird es noch eine zweite Website geben, die aktuell noch mit Contao 3 online ist. Hier gibt es schon umfangreiche Einträge (Weiterleitungen) in der .htaccess Datei, da es schon einige Umstellungen gab.
    Kann ich diese Einträge einfach in die 4.5. Installation übernehmen und wiederrum modifizieren?

    Welche Fehler darf ich auf keinen Fall machen, um Google (und andere) und natürlich den User nicht zu verärgern?

    Gibt es eine Liste mit Erklärungen, was man in eine .htaccess packen kann? Ich hatte mal eine Liste gesehen, die finde ich aber nicht mehr...

    Danke und Grüße
    Jan-Dirk

  2. #2
    Community-Moderatorin & Contao-Urgestein Avatar von mlweb
    Registriert seit
    10.07.2011.
    Beiträge
    6.715
    Contao-Projekt unterstützen

    Support Contao

    Standard

    Schau Dir mal den Beitrag und folgende an. Allerdings bin ich mir noch nicht im Klaren was davon gerade in Bezug auf das neue Caching in der Version 4.8 tatsächlich noch sinnvoll ist.

    Zitat Zitat von Jan-Dirk Beitrag anzeigen
    ich möchte am WE mit einer neuen Website online gehen, die ich in Contao 4.5 aufgebaut habe.
    Du willst nicht ernsthaft mit einer Version 4.5 online gehen, die seit Dezember 2017 keine Sicherheitsupdates mehr bekommt.
    Ich habe Dir mit meinen Hinweisen geholfen und Du möchtest Dich bedanken?
    Unterstütze bitte das Contao-Projekt (Button Links)
    Weitere Spendenmöglichkeiten
    ------------------------------------------------------------------------------------------------------
    Contao-Dokumentation: Contao-Handbuch und Contao-Entwickler-Doku
    Contao-Online-Video-Kurse: Contao Academy
    Funktionalität erweitern: Contao-Erweiterungen

    Für Dinge die man mit html5 und css3 lösen kann, braucht man kein javascript.




  3. #3
    Contao-Fan
    Registriert seit
    05.11.2012.
    Beiträge
    400

    Standard

    Danke für den Link.
    Zitat Zitat von mlweb Beitrag anzeigen
    Du willst nicht ernsthaft mit einer Version 4.5 online gehen, die seit Dezember 2017 keine Sicherheitsupdates mehr bekommt.
    Sorry, mein Fehler. Die Contao-Version ist 4.4.42.

    Zitat Zitat von mlweb Beitrag anzeigen
    Allerdings bin ich mir noch nicht im Klaren was davon gerade in Bezug auf das neue Caching in der Version 4.8 tatsächlich noch sinnvoll ist.
    Caching? Was kann ich mir darunter vorstellen?

  4. #4
    Community-Moderatorin & Contao-Urgestein Avatar von mlweb
    Registriert seit
    10.07.2011.
    Beiträge
    6.715
    Contao-Projekt unterstützen

    Support Contao

    Standard

    Zitat Zitat von Jan-Dirk Beitrag anzeigen

    Caching? Was kann ich mir darunter vorstellen?
    Caching = Cache verwenden/aufgebauen
    Hier werden die Neuerungen für Contao 4.8 angekündigt
    https://contao.org/de/news/contao_4-8-0.html
    Auf der Contao Konferenz wird es dazu einen Vortrag von Yanick geben https://www.contao-konferenz.de/prog...-anwender.html
    Aber wie gesagt betrifft das nicht die Version 4.4

    Nachtrag: Und hier ein Link zur korrekten Definition bei Wikipedia https://de.wikipedia.org/wiki/HTTP_Caching
    Geändert von mlweb (29.09.2019 um 12:57 Uhr)
    Ich habe Dir mit meinen Hinweisen geholfen und Du möchtest Dich bedanken?
    Unterstütze bitte das Contao-Projekt (Button Links)
    Weitere Spendenmöglichkeiten
    ------------------------------------------------------------------------------------------------------
    Contao-Dokumentation: Contao-Handbuch und Contao-Entwickler-Doku
    Contao-Online-Video-Kurse: Contao Academy
    Funktionalität erweitern: Contao-Erweiterungen

    Für Dinge die man mit html5 und css3 lösen kann, braucht man kein javascript.




  5. #5
    Contao-Urgestein
    Registriert seit
    20.09.2012.
    Ort
    Lüneburger Heide
    Beiträge
    1.971
    Partner-ID
    12207
    User beschenken
    Wunschliste
    Contao-Projekt unterstützen

    Support Contao

    Standard

    Zitat Zitat von Jan-Dirk Beitrag anzeigen
    ...

    Daher nun meine Frage: Welche Einträge muss eine funktionierende .htaccess-Datei aufweisen (Webhoster ist All-inkl., falls das wichtig ist)?

    Ich möchte auf jeden Fall von mit www. auf ohne umstellen.

    ...
    Hi,

    wenn Du sonst keine bestimmten Anforderungen hast, sollte die von Contao mitgelieferte .htaccess ausreichen.
    Hier mal ein Link zu Erdmann und Freunde zum Thema "Weiterleitung".
    https://erdmann-freunde.de/ressource...-redirect-www/

    Gruß
    tschero
    Autodidakt und HobbyWebdesigner

    www.webdesign24.biz
    Screencasts zu Contao

  6. #6
    Contao-Fan
    Registriert seit
    05.11.2012.
    Beiträge
    400

    Standard

    Zitat Zitat von tschero Beitrag anzeigen
    Hi,
    wenn Du sonst keine bestimmten Anforderungen hast, sollte die von Contao mitgelieferte .htaccess ausreichen.
    Gruß
    tschero
    Hallo tschero,
    das ist eigentlich genau meine Frage: Gibt es unter Contao und speziell unter Contao 4 Einträge in der htaccess, die wichtig wären oder die Contao (noch) besser machen? Was war denn unter C3 noch von Haus aus aktiviert (ich habe mich - ehrlich gesagt - nur um die Weiterleitung gekümmert, mit Hilfe dieses Forums )?
    Eigentlich wird doch von Contao 4 keine htaccess mehr mitgeliefert, oder?
    Jan-Dirk

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

    Standard

    In Contao 3 waren auch einige Caching Directives drin. Ich füge bspw. immer zusätzlich folgendes in die .htaccess von Contao 4 ein:
    Code:
    ##
    # 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>
    
    ##
    # Expires headers (for better cache control)
    # @see https://github.com/h5bp/html5-boilerplate
    ##
    <IfModule mod_expires.c>
      ExpiresActive on
    
      ##
      # Productional website
      ##
      ExpiresByType text/cache-manifest           "access plus 0 seconds"
      ExpiresByType text/html                     "access plus 0 seconds"
      ExpiresByType text/xml                      "access plus 0 seconds"
      ExpiresByType application/xml               "access plus 0 seconds"
      ExpiresByType application/json              "access plus 0 seconds"
      ExpiresByType application/rss+xml           "access plus 1 hour"
      ExpiresByType application/atom+xml          "access plus 1 hour"
      ExpiresByType image/gif                     "access plus 1 month"
      ExpiresByType image/png                     "access plus 1 month"
      ExpiresByType image/jpeg                    "access plus 1 month"
      ExpiresByType image/x-icon                  "access plus 1 month"
      ExpiresByType video/ogg                     "access plus 1 month"
      ExpiresByType audio/ogg                     "access plus 1 month"
      ExpiresByType video/mp4                     "access plus 1 month"
      ExpiresByType video/webm                    "access plus 1 month"
      ExpiresByType text/x-component              "access plus 1 month"
      ExpiresByType application/x-font-ttf        "access plus 1 month"
      ExpiresByType font/opentype                 "access plus 1 month"
      ExpiresByType application/x-font-woff       "access plus 1 month"
      ExpiresByType image/svg+xml                 "access plus 1 month"
      ExpiresByType application/vnd.ms-fontobject "access plus 1 month"
      ExpiresByType text/css                      "access plus 1 year"
      ExpiresByType application/javascript        "access plus 1 year"
    </IfModule>
    Müsste aber evt. auch mal aktualisiert werden - bspw. mit dem aktuellen Stand von https://github.com/h5bp/html5-boiler...dist/.htaccess

  8. #8
    Contao-Fan Avatar von Nightwing
    Registriert seit
    29.05.2013.
    Beiträge
    436

    Standard

    Zitat Zitat von Spooky Beitrag anzeigen
    Müsste aber evt. auch mal aktualisiert werden - bspw. mit dem aktuellen Stand von https://github.com/h5bp/html5-boiler...dist/.htaccess
    Das sollte dann wohl reichen, oder Spooky?

    Code:
    <IfModule mod_mime.c>
        ##
        # Data interchange
        ##
        AddType application/atom+xml                        atom
        AddType application/json                            json map topojson
        AddType application/ld+json                         jsonld
        AddType application/rss+xml                         rss
        AddType application/geo+json                        geojson
        AddType application/rdf+xml                         rdf
        AddType application/xml                             xml
    
        ##
        # JavaScript
        # Servers should use text/javascript for JavaScript resources.
        # https://html.spec.whatwg.org/multipage/scripting.html#scriptingLanguages
        ##
        AddType text/javascript                             js mjs
    
        ##
        # Manifest files
        ##
        AddType application/manifest+json                   webmanifest
        AddType application/x-web-app-manifest+json         webapp
        AddType text/cache-manifest                         appcache
    
        ##
        # Media files
        ##
        AddType audio/mp4                                   f4a f4b m4a
        AddType audio/ogg                                   oga ogg opus
        AddType image/bmp                                   bmp
        AddType image/svg+xml                               svg svgz
        AddType image/webp                                  webp
        AddType video/mp4                                   f4v f4p m4v mp4
        AddType video/ogg                                   ogv
        AddType video/webm                                  webm
        AddType video/x-flv                                 flv
    
        ##
        # Serving `.ico` image files with a different media type
        # prevents Internet Explorer from displaying them as images:
        # https://github.com/h5bp/html5-boilerplate/commit/37b5fec090d00f38de64b591bcddcb205aadf8ee
        ##
        AddType image/x-icon                                cur ico
    
        ##
        # WebAssembly
        ##
        AddType application/wasm                            wasm
    
        ##
        # Web fonts
        ##
        AddType font/woff                                   woff
        AddType font/woff2                                  woff2
        AddType application/vnd.ms-fontobject               eot
        AddType font/ttf                                    ttf
        AddType font/collection                             ttc
        AddType font/otf                                    otf
    
        ##
        # Other
        ##
        AddType application/octet-stream                    safariextz
        AddType application/x-bb-appworld                   bbaw
        AddType application/x-chrome-extension              crx
        AddType application/x-opera-extension               oex
        AddType application/x-xpinstall                     xpi
        AddType text/calendar                               ics
        AddType text/markdown                               markdown md
        AddType text/vcard                                  vcard vcf
        AddType text/vnd.rim.location.xloc                  xloc
        AddType text/vtt                                    vtt
        AddType text/x-component                            htc
    </IfModule>
    ToM

  9. #9
    Contao-Fan
    Registriert seit
    05.11.2012.
    Beiträge
    400

    Standard

    Zitat Zitat von Spooky Beitrag anzeigen
    In Contao 3 waren auch einige Caching Directives drin. Ich füge bspw. immer zusätzlich folgendes in die .htaccess von Contao 4 ein:
    Müsste aber evt. auch mal aktualisiert werden - bspw. mit dem aktuellen Stand von https://github.com/h5bp/html5-boiler...dist/.htaccess
    Wow, ja, genau diese Liste von github meinte ich in Erinnerung zu haben, danke!
    Aber nun ist es leider nicht so, dass ich genau wüsste, was von dieser Liste jetzt für mich wichtig wäre, aber die Auflistung von Spooky ist da ja eine riesige Hilfe.
    Das nun noch mit den Weiterleitungen von http -> https und von www auf ohne sollte für mich eigentlich reichen (hoffe ich).
    Jan-Dirk

  10. #10
    Wandelndes Contao-Lexikon Avatar von tab
    Registriert seit
    22.10.2013.
    Beiträge
    10.060
    Contao-Projekt unterstützen

    Support Contao

    Standard

    In der 3er .htaccess gab es auch eine Direktive um E-Tags zu deaktivieren. Macht das in Contao 4 auch Sinn und falls ja in welchen Versionen?

  11. #11
    Contao-Fan Avatar von Nightwing
    Registriert seit
    29.05.2013.
    Beiträge
    436

    Standard

    Zitat Zitat von tab Beitrag anzeigen
    In der 3er .htaccess gab es auch eine Direktive um E-Tags zu deaktivieren. Macht das in Contao 4 auch Sinn und falls ja in welchen Versionen?
    Ob es (noch) Sinn macht, weiss ich nicht, aber ich habs drin.
    Hier mal meine angepasste .htaccess Contao 4.8.3:

    Code:
    ##
    #  Increase php web memory limit
    ##
    php_value memory_limit 512M 
    
    ##
    #  Increase php execution time
    ##
    php_value max_execution_time 300
    
    ##
    #  Add Fast CGI
    ##
    #    AddHandler php-fastcgi .php
    
    ##
    #  IP blocking and protect backend
    ##
    SetEnvIf Request_URI ^/(contao($|/)|contao-manager\.phar\.php($|/)|_backup($|/)) require_auth=true
    AuthUserFile /www/htdocs/0815/_hp/web/.htpasswd
    AuthGroupFile /dev/null
    AuthName "Contao Backend Authentification"
    AuthType Basic
    require valid-user
    Order deny,allow
    Deny from all
    Allow from env=!require_auth
    #Allow from xx.xxx.xxx.xx
    Satisfy any
    
    ## 
    #  Disable ETags
    #  @see http://developer.yahoo.com/performance/rules.html# etags
    ## 
    FileETag None
    <IfModule mod_headers.c>
        Header unset ETag
    </IfModule>
    
    ## 
    #  MIME Types
    ## 
    <IfModule mod_mime.c>
        ##
        # Data interchange
        ##
        AddType application/atom+xml                        atom
        AddType application/json                            json map topojson
        AddType application/ld+json                         jsonld
        AddType application/rss+xml                         rss
        AddType application/geo+json                        geojson
        AddType application/rdf+xml                         rdf
        AddType application/xml                             xml
    
        ##
        # JavaScript
        # Servers should use text/javascript for JavaScript resources.
        # https://html.spec.whatwg.org/multipage/scripting.html#scriptingLanguages
        ##
        AddType text/javascript                             js mjs
    
        ##
        # Manifest files
        ##
        AddType application/manifest+json                   webmanifest
        AddType application/x-web-app-manifest+json         webapp
        AddType text/cache-manifest                         appcache
    
        ##
        # Media files
        ##
        AddType audio/mp4                                   f4a f4b m4a
        AddType audio/ogg                                   oga ogg opus
        AddType image/bmp                                   bmp
        AddType image/svg+xml                               svg svgz
        AddType image/webp                                  webp
        AddType video/mp4                                   f4v f4p m4v mp4
        AddType video/ogg                                   ogv
        AddType video/webm                                  webm
        AddType video/x-flv                                 flv
    
        ##
        # Serving `.ico` image files with a different media type
        # prevents Internet Explorer from displaying them as images:
        # https://github.com/h5bp/html5-boilerplate/commit/37b5fec090d00f38de64b591bcddcb205aadf8ee
        ##
        AddType image/x-icon                                cur ico
    
        ##
        # WebAssembly
        ##
        AddType application/wasm                            wasm
    
        ##
        # Web fonts
        ##
        AddType font/woff                                   woff
        AddType font/woff2                                  woff2
        AddType application/vnd.ms-fontobject               eot
        AddType font/ttf                                    ttf
        AddType font/collection                             ttc
        AddType font/otf                                    otf
    
        ##
        # Other
        ##
        AddType application/octet-stream                    safariextz
        AddType application/x-bb-appworld                   bbaw
        AddType application/x-chrome-extension              crx
        AddType application/x-opera-extension               oex
        AddType application/x-xpinstall                     xpi
        AddType text/calendar                               ics
        AddType text/markdown                               markdown md
        AddType text/vcard                                  vcard vcf
        AddType text/vnd.rim.location.xloc                  xloc
        AddType text/vtt                                    vtt
        AddType text/x-component                            htc
    </IfModule>
    
    ## 
    #  URL rewriting
    ## 
    <IfModule mod_rewrite.c>
        RewriteEngine On
    
        <IfModule mod_headers.c>
            # Assets in /assets and /bundles either contain a hash in their filename
            # or are called with a ?version suffix, therefore cache them for 1 year.
            RewriteRule ^(assets|bundles)/ - [ENV=CONTAO_ASSETS:true]
            Header set Cache-Control "max-age=31536000" env=CONTAO_ASSETS
    
            # Allow CORS on the Contao TinyMCE skin.
            RewriteRule ^assets/tinymce4/js/skins/contao/fonts/ - [ENV=CONTAO_TINYMCE_SKIN:true]
            Header set Access-Control-Allow-Origin "*" env=CONTAO_TINYMCE_SKIN
        </IfModule>
    
        ##
        #  Access denied for .htaccess
        ##
        RewriteRule ^\.htaccess$ - [F]
        RewriteRule ^\.htpasswd$ - [F]
        
        ##
        #  Block bad bots
        ##
        RewriteCond %{HTTP_USER_AGENT} ^BlackWidow [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Bot\ mailto:craftbot@yahoo.com [OR]
        RewriteCond %{HTTP_USER_AGENT} ^ChinaClaw [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Custo [OR]
        RewriteCond %{HTTP_USER_AGENT} ^DISCo [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Download\ Demon [OR]
        RewriteCond %{HTTP_USER_AGENT} ^eCatch [OR]
        RewriteCond %{HTTP_USER_AGENT} ^EirGrabber [OR]
        RewriteCond %{HTTP_USER_AGENT} ^EmailSiphon [OR]
        RewriteCond %{HTTP_USER_AGENT} ^EmailWolf [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Express\ WebPictures [OR]
        RewriteCond %{HTTP_USER_AGENT} ^ExtractorPro [OR]
        RewriteCond %{HTTP_USER_AGENT} ^EyeNetIE [OR]
        RewriteCond %{HTTP_USER_AGENT} ^FlashGet [OR]
        RewriteCond %{HTTP_USER_AGENT} ^GetRight [OR]
        RewriteCond %{HTTP_USER_AGENT} ^GetWeb! [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Go!Zilla [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Go-Ahead-Got-It [OR]
        RewriteCond %{HTTP_USER_AGENT} ^GrabNet [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Grafula [OR]
        RewriteCond %{HTTP_USER_AGENT} ^HMView [OR]
        RewriteCond %{HTTP_USER_AGENT} HTTrack [NC,OR]
        RewriteCond %{HTTP_USER_AGENT} ^Image\ Stripper [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Image\ Sucker [OR]
        RewriteCond %{HTTP_USER_AGENT} Indy\ Library [NC,OR]
        RewriteCond %{HTTP_USER_AGENT} ^InterGET [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Internet\ Ninja [OR]
        RewriteCond %{HTTP_USER_AGENT} ^JetCar [OR]
        RewriteCond %{HTTP_USER_AGENT} ^JOC\ Web\ Spider [OR]
        RewriteCond %{HTTP_USER_AGENT} ^larbin [OR]
        RewriteCond %{HTTP_USER_AGENT} ^LeechFTP [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Mass\ Downloader [OR]
        RewriteCond %{HTTP_USER_AGENT} ^MIDown\ tool [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Mister\ PiX [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Navroad [OR]
        RewriteCond %{HTTP_USER_AGENT} ^NearSite [OR]
        RewriteCond %{HTTP_USER_AGENT} ^NetAnts [OR]
        RewriteCond %{HTTP_USER_AGENT} ^NetSpider [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Net\ Vampire [OR]
        RewriteCond %{HTTP_USER_AGENT} ^NetZIP [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Octopus [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Offline\ Explorer [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Offline\ Navigator [OR]
        RewriteCond %{HTTP_USER_AGENT} ^PageGrabber [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Papa\ Foto [OR]
        RewriteCond %{HTTP_USER_AGENT} ^pavuk [OR]
        RewriteCond %{HTTP_USER_AGENT} ^pcBrowser [OR]
        RewriteCond %{HTTP_USER_AGENT} ^RealDownload [OR]
        RewriteCond %{HTTP_USER_AGENT} ^ReGet [OR]
        RewriteCond %{HTTP_USER_AGENT} ^SiteSnagger [OR]
        RewriteCond %{HTTP_USER_AGENT} ^SmartDownload [OR]
        RewriteCond %{HTTP_USER_AGENT} ^SuperBot [OR]
        RewriteCond %{HTTP_USER_AGENT} ^SuperHTTP [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Surfbot [OR]
        RewriteCond %{HTTP_USER_AGENT} ^tAkeOut [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Teleport\ Pro [OR]
        RewriteCond %{HTTP_USER_AGENT} ^VoidEYE [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Web\ Image\ Collector [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Web\ Sucker [OR]
        RewriteCond %{HTTP_USER_AGENT} ^WebAuto [OR]
        RewriteCond %{HTTP_USER_AGENT} ^WebCopier [OR]
        RewriteCond %{HTTP_USER_AGENT} ^WebFetch [OR]
        RewriteCond %{HTTP_USER_AGENT} ^WebGo\ IS [OR]
        RewriteCond %{HTTP_USER_AGENT} ^WebLeacher [OR]
        RewriteCond %{HTTP_USER_AGENT} ^WebReaper [OR]
        RewriteCond %{HTTP_USER_AGENT} ^WebSauger [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Website\ eXtractor [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Website\ Quester [OR]
        RewriteCond %{HTTP_USER_AGENT} ^WebStripper [OR]
        RewriteCond %{HTTP_USER_AGENT} ^WebWhacker [OR]
        RewriteCond %{HTTP_USER_AGENT} ^WebZIP [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Wget [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Widow [OR]
        RewriteCond %{HTTP_USER_AGENT} ^WWWOFFLE [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Xaldon\ WebSpider [OR]
        RewriteCond %{HTTP_USER_AGENT} ^Zeus
        RewriteRule ^.* - [F,L]
    
        ##
        # URL with trailing slash suffix (/)
        ##
        RewriteCond %{REQUEST_URI} !^/contao(.*)$
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_URI} ^/[^\.]+[^/]$
        RewriteRule (.+)\.html$ /$1/ [L,R=301]
        
        ##
        # This rule allows input of alias without the URL suffix, i.e. http://domain.com/files
        # The rule add the suffix. 
        ##
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_URI} !^/contao$
        RewriteRule ^([^./]+)$ /$1/ [L,R=301]
        
        ##
        #  SSL & no www
        ##
        RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
        RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
        RewriteCond %{HTTPS} !on
        RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
    
        ##
        #  Prevent Hotlinking from files
        ##
        <IfModule mod_rewrite.c>
            RewriteCond %{HTTP_REFERER} !^$
            RewriteCond %{HTTP_REFERER} !^https?://([^.]+\.)?domain.tld/.*$ [NC]
            RewriteCond %{REQUEST_FILENAME} !no_hotlink.png$
            RewriteRule .*\.(gif|jpe?g|png|bmp)$ https://%{HTTP_HOST}/files/layout/no_hotlink.png [NC,R,L]
        </ifModule>
    
        ##
        # The following rules are required if you want to redirect old URL fragments
        # to a new URL.
        # Useful when using the auto-items Parameter.
        ##
        #Eigene Rewrite Rules hier
    
        ## 
        #  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]
        
        # 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 index.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}]
    
        # Redirect to URI without front controller to prevent duplicate content
        # (with and without `/index.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 ^index\.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}/index.php [L]
    </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 ^/$ /index.php/
            # RedirectTemp cannot be used instead
        </IfModule>
    </IfModule>
    ToM

  12. #12
    Contao-Nutzer
    Registriert seit
    23.06.2009.
    Beiträge
    200

    Standard

    Weil auch Erdmann & Freunde genannt wurde: das euf_nutshell_kit bringt auch eine
    angepasste und sehr umfangreiche .htaccess Datei mit, die praktisch keine Wünsche
    offen lässt, siehe hier:

    https://github.com/ErdmannFreunde/eu.../web/.htaccess

    Update: habe gerade gesehen, dass oben bereits die .htaccess Datei von Boilerplate erwähnt wurde
    und das dürfte auch die Basis von EuF sein, nur aktueller. Ggfs. müsste man wohl kurz abgleichen,
    ob Dennis irgendwas Contao spezifisches ergänzt hat.

    Beste Grüße
    Sares
    Geändert von Sares (01.10.2019 um 12:41 Uhr) Grund: Erklärung ergänzt

  13. #13
    Contao-Fan
    Registriert seit
    05.11.2012.
    Beiträge
    400

    Standard

    Zitat Zitat von Sares Beitrag anzeigen
    Weil auch Erdmann & Freunde genannt wurde: das euf_nutshell_kit bringt auch eine
    angepasste und sehr umfangreiche .htaccess Datei mit, die praktisch keine Wünsche
    offen lässt, siehe hier:

    https://github.com/ErdmannFreunde/eu.../web/.htaccess

    Update: habe gerade gesehen, dass oben bereits die .htaccess Datei von Boilerplate erwähnt wurde
    und das dürfte auch die Basis von EuF sein, nur aktueller. Ggfs. müsste man wohl kurz abgleichen,
    ob Dennis irgendwas Contao spezifisches ergänzt hat.

    Beste Grüße
    Sares
    Wenn ich mir nun diese htaccess-Einträge eins zu eins kopiere und in meine Datei packe, mache ich damit etwas falsch?
    Dann noch meine Umleitungen und fertig?

  14. #14
    Contao-Nutzer
    Registriert seit
    23.06.2009.
    Beiträge
    200

    Standard

    Hallo Jan-Dirk,

    im Prinzip ja, je nach Server und Hosting-Anbieter könnte es noch sein, dass Du
    vielleicht bei den Abschnitten mit mod_rewrite und der Umleitung z.B. von http
    auf https ein paar Varianten ausprobieren musst (hier hilft aber oft ein Blick in
    den Supportbereich Deines Hosters), oder das gewisse Features vielleicht nicht
    von Deinem Hosting-Anbieter unterstützt werden.

    Ich glaube, ich habe auch noch ein paar kleine Anpassungen bei den Cache-Zeiten gemacht
    (um Google Pagespeed Insights zu gefallen) und einen Abschnitt für mod_pagespeed ergänzt,
    da das unser Hoster unterstützt.

    Hier hilft aber einfach mal ausprobieren.
    Viel Erfolg!

    Beste Grüße
    Sares

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
  •