Improve your page speed score

Although Pavilion comes with good optimizations, there are some things that cannot be automated and you should tune them up manually. In order to get higher page speed results, please check out the following points:

1Make sure the cache is turned on.

2 Turn mod_deflate Compression On. Mod Deflate is an apache web server module that automatically compresses the output before being sent to the browser. This reduces the size of the content decreasing the time needed to transmit it the browser. There are plenty of tutorials on google how to enable mod_deflate. Here is the configuration we use for Pavilion demo (it should be put in the .htaccess file):

# Compressing output
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
AddOutputFilterByType DEFLATE image/x-icon image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
</Ifmodule>
Some hosting providers configurations do not allow to enable these settings through .htaccess. In this case you should ask your server adminsitrator to do it.

3 Set headers expiration. This directive will tell the browser to cache the static resources. This will improve the subsequent page hits as the resources (scripts, styles) will be served from the browser cache and not loaded through the network. The Pavilion demo uses the following setup:

# BEGIN Expire headers
<ifModule mod_expires.c>
 ExpiresActive On
 ExpiresDefault "access plus 5 seconds"
 ExpiresByType image/x-icon "access plus 2592000 seconds"
 ExpiresByType image/jpeg "access plus 2592000 seconds"
 ExpiresByType image/png "access plus 2592000 seconds"
 ExpiresByType image/gif "access plus 2592000 seconds"
 ExpiresByType font/opentype "access plus 2592000 seconds"
 ExpiresByType application/x-font-woff "access plus 2592000 seconds"
 ExpiresByType application/x-font-woff "access plus 2592000 seconds"
 ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
 ExpiresByType text/css "access plus 604800 seconds"
 ExpiresByType text/javascript "access plus 216000 seconds"
 ExpiresByType application/javascript "access plus 216000 seconds"
 ExpiresByType application/x-javascript "access plus 216000 seconds"
 ExpiresByType text/html "access plus 600 seconds"
 ExpiresByType application/xhtml+xml "access plus 600 seconds"
</ifModule>
# END Expire headers

# BEGIN Cache-Control Headers
<ifModule mod_headers.c>
 <filesMatch "\.(ico|jpe?g|png|gif|swf)$">
 Header set Cache-Control "public"
 </filesMatch>
 <filesMatch "\.(css)$">
 Header set Cache-Control "public"
 </filesMatch>
 <filesMatch "\.(js)$">
 Header set Cache-Control "private"
 </filesMatch>
 <filesMatch "\.(x?html?|php)$">
 Header set Cache-Control "private, must-revalidate"
 </filesMatch>
</ifModule>
# END Cache-Control Headers

# Defining MIME types to ensure the web server actually knows about them.
<IfModule mod_mime.c>
 AddType application/javascript js
 AddType application/vnd.ms-fontobject eot
 AddType application/x-font-ttf ttf ttc
 AddType font/opentype otf
 AddType application/x-font-woff woff woff2
 AddType image/svg+xml svg svgz
 AddEncoding gzip svgz
</Ifmodule>

<FilesMatch "\.(xml|txt|css|js)$">
Header set Cache-Control "max-age=604800, public"
ExpiresDefault "access plus 1 week"
</FilesMatch>

#JPG JPEG PNG GIF SWF SVG - 1 MONTH
<FilesMatch "\.(jpg|jpeg|png|gif|swf|svg|JPG|JPEG|PNG|GIF|SWF|SVG)$">
Header set Cache-Control "max-age=2503000, public"
ExpiresDefault "access plus 1 month"
Header set Last-Modified "Wed, 05 Jun 2009 06:40:46 GMT"
</FilesMatch>

#OTF WOFF TTF ICO PDF FLV - 1 MONTH
<FilesMatch "\.(otf|ico|pdf|flv|woff|woff2|ttf)$">
Header set Cache-Control "max-age=2502000, public"
ExpiresDefault "access plus 1 month"
</FilesMatch>

<FilesMatch "\.(jpg|jpeg|png|gif|swf|svg|JPG|JPEG|PNG|GIF|SWF|SVG)$">
Header unset Cookie
Header unset Set-Cookie
</FilesMatch>

Again, some hosting providers won’t allow you to enable these directives with .htaccess. You should write to the support staff to enable them.