Quantcast
Viewing all articles
Browse latest Browse all 4243

Recommended Cache-control / Expires settings (no replies)

I have noticed that the Piwik js and gif elements take relatively long times to load and I was wondering what I can do to speed the process up.

I am using the following in my htaccess to set the Cache-Control and Expires headers.

############ headers and caching  

<ifModule mod_expires.c>
	ExpiresActive On
	ExpiresDefault A86400
	ExpiresByType image/gif A2592000
	ExpiresByType text/javascript A86400
</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=86400, 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

What are the recommendations for these settings, and is there anything else I can do to speed the page loading of the Piwik elements?

Viewing all articles
Browse latest Browse all 4243

Trending Articles