Improving the Speed of XenForo

Sorry, I mispoke. I am referring to saving 400kb from my benchmark rating. Bandwidth is not something I am concerned about.
 
Using gtmetrix.com I get an F for Leverage browser caching. Looking at their help page for this:

http://gtmetrix.com/leverage-browser-caching.html

I was wondering what others have done to improve this.

If you are using WHM/cPanel, go into your website's WHM and then go to EasyApache.

Then go to the exhaustive options list and click deflate. Then save.

Afterwards, add this to your root .htaccess file :)

Code:
# Insert filter
SetOutputFilter DEFLATE

# 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

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

# Don't compress already compressed stuff !
SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar|swf)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .pdf$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary

ExpiresActive on
ExpiresByType image/gif "access plus 1 months"
ExpiresByType image/jpeg "access plus 1 months"
ExpiresByType image/png "access plus 1 months"
ExpiresByType image/x-icon "access plus 12 months"
ExpiresByType application/x-javascript "access plus 1 months"
ExpiresByType text/css "access plus 1 months"
ExpiresByType application/x-shockwave-flash "access plus 1 months"
 
I have found Google Adsense to increase requests and load time considerably. Deferring Javascript seems to be the best way to improve your YSlow grade.
 
Anybody, please check this code:
Code:
# START: MOD_EXPIRES
ExpiresActive On
# Set Images to Expire After a Month
ExpiresByType image/gif "access plus 1 month"
ExpiresByType image/png "access plus 1 month"
ExpiresByType image/jpeg "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 month"
# Set CSS/JS to Expire After a Month
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/javascript "access plus 1 month"

#SetOutputFilter DEFLATE
AddOutputFilter DEFLATE xhtml html htm php css js xml xsl txt plain javascript x-javascript ico
# END: MOD_EXPIRES


Header unset Pragma
FileETag None
Header unset ETag

# 1 YEAR
<FilesMatch "\.(ico|pdf|flv)$">
Header set Cache-Control "max-age=29030400, public"
</FilesMatch>
# 1 WEEK
<FilesMatch "\.(jpg|jpeg|png|gif|swf)$">
Header set Cache-Control "max-age=604800, public"
</FilesMatch>
# 2 DAYS 172800
<FilesMatch "\.(xml|txt|css|js)$">
Header set Cache-Control "max-age=604800, proxy-revalidate"
</FilesMatch>
# 1 MIN
<FilesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=240, private, proxy-revalidate"
</FilesMatch>

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Expires "Thu, 20 Dec 2012 20:00:00 GMT"
</FilesMatch>


<IfModule mod_mime.c>
AddType text/css .css
AddType application/x-javascript .js
AddType text/richtext .rtf .rtx
AddType image/svg+xml .svg .svgz
AddType text/plain .txt
AddType text/xsd .xsd
AddType text/xsl .xsl
AddType text/xml .xml
AddType image/bmp .bmp
AddType application/java .class
AddType image/gif .gif
AddType application/x-gzip .gz .gzip
AddType image/x-icon .ico
AddType image/jpeg .jpg .jpeg .jpe
AddType application/vnd.ms-access .mdb
AddType application/pdf .pdf
AddType image/png .png
AddType application/x-shockwave-flash .swf
AddType image/tiff .tif .tiff
AddType application/zip .zip
</IfModule>
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType text/css A31536000
ExpiresByType application/x-javascript A31536000
ExpiresByType text/richtext A3600
ExpiresByType image/svg+xml A3600
ExpiresByType text/plain A3600
ExpiresByType text/xsd A3600
ExpiresByType text/xsl A3600
ExpiresByType text/xml A3600
ExpiresByType image/bmp A31536000
ExpiresByType application/java A31536000
ExpiresByType image/gif A31536000
ExpiresByType application/x-gzip A31536000
ExpiresByType image/x-icon A31536000
ExpiresByType image/jpeg A31536000
ExpiresByType application/vnd.ms-access A31536000
ExpiresByType application/pdf A31536000
ExpiresByType image/png A31536000
ExpiresByType application/x-shockwave-flash A31536000
ExpiresByType image/tiff A31536000
ExpiresByType application/zip A31536000
</IfModule>

AddOutputFilterByType DEFLATE text/html text/xml text/css text/plain
AddOutputFilterByType DEFLATE image/svg+xml application/xhtml+xml application/xml
AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml
AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript
AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-otf
AddOutputFilterByType DEFLATE font/truetype font/opentype


<IfModule mod_deflate.c>
    <IfModule mod_setenvif.c>
        BrowserMatch ^Mozilla/4 gzip-only-text/html
        BrowserMatch ^Mozilla/4\.0[678] no-gzip
        BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
        BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
    </IfModule>
    <IfModule mod_headers.c>
        Header append Vary User-Agent env=!dont-vary
    </IfModule>
    AddOutputFilterByType DEFLATE text/css application/x-javascript text/html text/richtext image/svg+xml text/plain text/xsd text/xsl text/xml image/x-icon
</IfModule>
<FilesMatch "\.(css|js)$">
    <IfModule mod_headers.c>
        Header set Pragma "public"
        Header set Cache-Control "public, must-revalidate, proxy-revalidate"
    </IfModule>
    FileETag MTime Size
    <IfModule mod_headers.c>
        Header set X-Powered-By "W3 Total Cache/0.9.1.3"
    </IfModule>
</FilesMatch>
<FilesMatch "\.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$">
    <IfModule mod_headers.c>
        Header set Pragma "public"
        Header set Cache-Control "public, must-revalidate, proxy-revalidate"
    </IfModule>
    FileETag MTime Size
    <IfModule mod_headers.c>
        Header set X-Powered-By "W3 Total Cache/0.9.1.3"
    </IfModule>
</FilesMatch>
<FilesMatch "\.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|swf|tar|tif|tiff|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$">
    <IfModule mod_headers.c>
        Header set Pragma "public"
        Header set Cache-Control "public, must-revalidate, proxy-revalidate"
    </IfModule>
    FileETag MTime Size
    <IfModule mod_headers.c>
        Header set X-Powered-By "W3 Total Cache/0.9.1.3"
    </IfModule>
</FilesMatch>
 
Yes, it reduces the time on the first page rendering. That is what Google and other search engines are using to check the speed of websites. Google have been very open about the fact that search engine rankings use the speed of a website as a factor. Their PageSpeed service advises Javascript to be moved to the bottom.
Just FYI - if your page already loads in a reasonable amount of time, making it slightly faster isn't going to make you rank any better. It's more about if your page is so slow that it gives users a bad experience (think like a page that takes 30 seconds to load), your ranking for things will be pushed down. It's more about the user experience, not the actual speed of the site loading (but in some cases, they can be connected when your site is really, really, really slow).

Moving JavaScript to the end of the page isn't going to make XenForo load so much faster than it gives an sort of significantly better user experience... and that is what Google is ultimately talking about.

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
 
If you are using WHM/cPanel, go into your website's WHM and then go to EasyApache.

Then go to the exhaustive options list and click deflate. Then save.

Afterwards, add this to your root .htaccess file :)

Code:
# Insert filter
SetOutputFilter DEFLATE

# 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

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

# Don't compress already compressed stuff !
SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar|swf)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .pdf$ no-gzip dont-vary

# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary

ExpiresActive on
ExpiresByType image/gif "access plus 1 months"
ExpiresByType image/jpeg "access plus 1 months"
ExpiresByType image/png "access plus 1 months"
ExpiresByType image/x-icon "access plus 12 months"
ExpiresByType application/x-javascript "access plus 1 months"
ExpiresByType text/css "access plus 1 months"
ExpiresByType application/x-shockwave-flash "access plus 1 months"
What if I remove this?
Code:
# Don't compress images
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary

# Don't compress already compressed stuff !
SetEnvIfNoCase Request_URI .(?:exe|t?gz|zip|bz2|sit|rar|swf)$ no-gzip dont-vary
SetEnvIfNoCase Request_URI .pdf$ no-gzip dont-vary
 
Top Bottom