J!5.1.0 Nachinstallationshinweis Brotli compression

  • Ich habe mal eine neue J5.1.0-Installation gemacht.

    Dort wird in der htaccess beides aufgeführt:


    Spoiler anzeigen

    ## GZIP & BROTLI

    ## These directives are only enabled if the Apache mod_headers module is enabled.

    ## This section will check if a .gz file exists and if so will stream it

    ## directly or fallback to gzip any asset on the fly

    ## If your site starts to look strange after enabling this file, and you see

    ## ERR_CONTENT_DECODING_FAILED in your browser console network tab,

    ## then your server is already gzipping css and js files and you don't need this

    ## block enabled in your .htaccess

    <IfModule mod_headers.c>

    # Serve gzip compressed CSS files if they exist

    # and the client accepts gzip.

    RewriteCond "%{HTTP:Accept-encoding}" "gzip"

    RewriteCond "%{REQUEST_FILENAME}\.gz" -s

    RewriteRule "^(.*)\.css" "$1\.css\.gz" [QSA]

    # Serve gzip compressed JS files if they exist

    # and the client accepts gzip.

    RewriteCond "%{HTTP:Accept-encoding}" "gzip"

    RewriteCond "%{REQUEST_FILENAME}\.gz" -s

    RewriteRule "^(.*)\.js" "$1\.js\.gz" [QSA]

    # Serve correct content types, and prevent mod_deflate double compression.

    RewriteRule "\.css\.gz$" "-" [T=text/css,E=no-gzip:1,E=no-brotli:1]

    RewriteRule "\.js\.gz$" "-" [T=text/javascript,E=no-gzip:1,E=no-brotli:1]

    <FilesMatch "(\.js\.gz|\.css\.gz)$">

    # Serve correct encoding type.

    Header set Content-Encoding gzip

    # Force proxies to cache gzipped &

    # non-gzipped css/js files separately.

    Header append Vary Accept-Encoding

    </FilesMatch>

    </IfModule>

    Kann man ja dann Auskommentieren (#), wenn man es möchte!

    Somit für mich erledigt. :)

    Gruß Elwood

  • Besser Spät als nie, ich geb da auch mal meinen Senf dazu:

    In den Headerinformationen des Browsers kann eingesehen werden, ob Brotli genutzt wird, oder nicht.

    x-content-encoding-over-network: gzip oder

    x-content-encoding-over-network: br

    Hab das mal getestet mit einer Joomla 4 und der defautlt .htaccess:

    Wenn ich gzip in Joomla aktiviere, wird es genutzt. Ist der Server für Brotli konfiguriert und ich deaktiviere gzip in Joomla, wird Brotli genutzt.

    Mit dem Tool auf der Seite von cybergurk konnte ich dann sehen, dass Brotli die bessere Komprimierung macht ;)

  • Siehe hier:

    eumel1602
    6. Mai 2024 um 17:01

    Gruß Elwood