Skip to content

Instantly share code, notes, and snippets.

@kikmedia
Created August 30, 2013 14:41
Show Gist options
  • Save kikmedia/6390579 to your computer and use it in GitHub Desktop.
Save kikmedia/6390579 to your computer and use it in GitHub Desktop.
.htaccess für Piwik, um Indizierung zu verhindern, Caching einzustellen und ein paar andere häßliche Dinge zu tun.
############ headers and caching
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault A86400
ExpiresByType image/gif A2592000
ExpiresByType text/javascript A2592000
</ifModule>
### HEADER CACHING
<ifModule mod_headers.c>
<FilesMatch "\.(gif|ico)$">
Header set Cache-Control "max-age=2592000, public"
</FilesMatch>
<FilesMatch "\.(js)$">
Header set Cache-Control "max-age=2592000, private, must-revalidate"
</FilesMatch>
<FilesMatch "\.(php)$">
Header set Cache-Control "private, no-store, no-cache, must-revalidate, no-transform, max-age=0"
Header set Pragma "no-cache"
</FilesMatch>
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
# No indexing of Piwik files by robots
Header append X-Robots-Tag "noindex"
</ifModule>
<IfModule mod_deflate.c>
<IfModule mod_filter.c>
AddOutputFilterByType DEFLATE application/javascript \
application/json
</IfModule>
<IfModule mod_setenvif.c>
# Don't compress images
SetEnvIfNoCase Request_URI .(?:gif)$ no-gzip dont-vary
</IfModule>
</IfModule>
############ End of headers and caching
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment