Archives / Snippets / Projets

apache2ctl -M | sort
a2enmod headers
apache2ctl restart

Mettre en fin de /etc/apache2/apache.conf

Options All -Indexes

FileETag None

<IfModule mod_dir.c>
    DirectoryIndex index.php
</IfModule>

<IfModule mod_php5.c>
    php_value default_charset UTF-8
</IfModule>

<IfModule mod_headers.c>
    Header unset ETag
</IfModule>

<IfModule mod_filter.c>
    AddType image/x-icon .ico
    AddOutputFilterByType DEFLATE image/x-icon
</IfModule>

<IfModule mod_headers.c>
    # 1 an
    <FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
    Header set Cache-Control "max-age=29030400, public"
    </FilesMatch>

    # 1 semaine
    <FilesMatch "\.(jpg|jpeg|png|gif|swf|js|py|css)$">
    Header set Cache-Control "max-age=604800, public"
    </FilesMatch>

    # 3 heures
    <FilesMatch "\.(txt|xml)$">
    Header set Cache-Control "max-age=10800"
    </FilesMatch>

    # Jamais
    <FilesMatch "\.(html|htm|php|cgi|pl)$">
    Header set Cache-Control "max-age=0, private, no-store, no-cache, must-revalidate"
    </FilesMatch>
</IfModule>