Apache/deflate expires.conf

aus www.kruedewagen.de, Homepage von Ralf und Judith Krüdewagen (Kruedewagen)
< Apache
Version vom 26. August 2014, 06:38 Uhr von Rkr (Diskussion | Beiträge) (Die Seite wurde neu angelegt: „<syntaxhighlight lang="apache"> # http://betterexplained.com/articles/how-to-optimize-your-site-with-gzip-compression/ # http://gtmetrix.com/enable-gzip-compre…“)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen
# http://betterexplained.com/articles/how-to-optimize-your-site-with-gzip-compression/
# http://gtmetrix.com/enable-gzip-compression.html
# http://stackoverflow.com/questions/12367858/how-can-i-get-apache-gzip-compression-to-work
# http://tecadmin.net/how-to-enable-gzip-compression-on-apache/
# http://www.linux-faqs.info/apache/optimize-website-speed-with-mod-expire-and-mod-deflate

#http://httpd.apache.org/docs/2.2/mod/core.html#fileetag
# "none" might be problematic with wiki images being updated?
#FileETag none

<IfModule mod_deflate.c>
        # Insert filters
        AddOutputFilterByType DEFLATE text/plain
        AddOutputFilterByType DEFLATE text/html
        AddOutputFilterByType DEFLATE text/xml
        AddOutputFilterByType DEFLATE text/css
        AddOutputFilterByType DEFLATE text/javascript
        AddOutputFilterByType DEFLATE application/xml
        AddOutputFilterByType DEFLATE application/xhtml+xml
        AddOutputFilterByType DEFLATE application/atom+xml
        AddOutputFilterByType DEFLATE application/rss+xml
        AddOutputFilterByType DEFLATE application/javascript
        AddOutputFilterByType DEFLATE application/x-javascript
        AddOutputFilterByType DEFLATE application/x-httpd-php
        AddOutputFilterByType DEFLATE application/x-httpd-fastphp
        AddOutputFilterByType DEFLATE application/x-httpd-php-source
        AddOutputFilterByType DEFLATE image/svg+xml

        <IfModule mod_setenvif.c>
                # Drop problematic browsers
                # Netscape 4.x has some problems...
                BrowserMatch ^Mozilla/4 gzip-only-text/html
                # Netscape 4.06-4.08 have some more problems
                BrowserMatch ^Mozilla/4\.0[678] no-gzip
                # MSIE masquerades as Netscape, but it is fine
                BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
                BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html

                # Don't compress images
                SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

                # Make sure proxies don't deliver the wrong content
                <IfModule mod_headers.c>
                        Header append Vary User-Agent env=!dont-vary
                </IfModule>
        </IfModule>
</IfModule>

<IfModule mod_expires.c>
        ExpiresActive On
        ExpiresByType text/html A1
        ExpiresByType application/xhtml+xml A1
        # Add Expire header set to 30 days (far future)
        ExpiresByType text/css A2592000
        ExpiresByType text/javascript A2592000
        ExpiresByType application/javascript A2592000
        ExpiresByType application/x-javascript A2592000
        ExpiresByType image/gif A2592000
        ExpiresByType image/png A2592000
        ExpiresByType image/jpg A2592000
        ExpiresByType image/jpeg A2592000
        ExpiresByType image/x-icon A2592000
        ExpiresByType image/vnd.microsoft.icon A2592000
        ExpiresByType image/svg+xml A2592000
        ExpiresByType text/plain A2592000
        # Add Expire header set to 1 day
        ExpiresByType text/xml A108000
        ExpiresByType application/x-httpd-php A108000
        ExpiresByType application/x-httpd-fastphp A108000
        ExpiresByType application/x-httpd-php-source A108000
        # Add Expire header set to 1 hour
        ExpiresByType application/xml A108000
        ExpiresByType application/atom+xml A108000
        ExpiresByType application/rss+xml A108000
</IfModule>

# Fallback - when there is no mod_expires, try to add far future expire headers using mod_headers
<IfModule !mod_expires.c>
        <IfModule mod_headers.c>
                <Files ~ "\.(gif|jpe?g|png|css|ico|js)$">
                        Header set Expires "Thu, 15 Apr 2020 20:00:00 GMT"
                </Files>
        </IfModule>
</IfModule>