Site Performance Quick Fixes
I've been playing around with YSlow for a while now, now I decided to a quick test on this blog.
This blog, according to YSlow rates a frumpy Grade D, with a score of 61. Not bad, but not great.
A bit of .htaccess trickery should give me a few extra points... Excellent Grade C, with a score of 73.
Here's the modified .htaccess file. Some of this is blatantly stolen borrowed from the AskApache Guru.
# Turn on Expires and set default to 0
ExpiresActive On
ExpiresDefault A0
# Set up caching on media files for 1 year (forever?)
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
ExpiresDefault A29030400
Header append Cache-Control "public"
</FilesMatch>
# Set up caching on media files for 1 week
<FilesMatch "\.(gif|jpg|jpeg|png|swf)$">
ExpiresDefault A604800
Header append Cache-Control "public"
</FilesMatch>
# Set up 2 Hour caching on commonly updated files
<FilesMatch "\.(xml|txt|html|js|css)$">
ExpiresDefault A7200
Header append Cache-Control "proxy-revalidate"
</FilesMatch>
# Force no caching for dynamic files
<FilesMatch "\.(php|cgi|pl|htm)$">
ExpiresActive Off
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
</FilesMatch>
# deflate JS and CSS
<IfModule mod_deflate.c>
<FilesMatch "\.(js|css)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
# Disable pesky ETags.
Header unset ETag
FileETag None
What have we done?
- Setup caching on most of the commonly served files
- Set Javascript and CSS files be GZipped
- Disabled ETags.
So, jumping up a grade for just a simple cut and paste job? Can't be bad.
What else can we do? Well, theres lots. For example, I use the LightView Plus plugin, it's very JS & CSS heavy. Disabling it adds 13 points, taking me up to a score of 86. It also saves 50k of code.
Take a look at your Wordpress plugins. Do you really need them all? Perhaps try loading the plugins only on the pages you require them on. cformsII lets you do exactly that!
Related posts:
- WP Super Cache – I’m impressed
Pictures speak better than words... WP Super Cache has shaved nearly 3 seconds off the... - Using Wordpress header and footers externally
I needed to integrate a Wordpress header (header.php) and footer (footer.php) into an external application.... - Enabling mod_deflate/gzip globally on cPanel
There's far too many reasons to mention why you should enable mod_deflate to gzip your...
What this article useful to you?
Let me know, buy me a beer!
Alternatively, if you're feeling impecunious, you may like to subscribe to my RSS feed, or see other articles in the Apache, Wordpress category.
Gallery
Categories
- Apache
- Automotive
- CentOS
- cPanel/WHM
- CubeCart
- Domains
- Exchange
- Geeky
- General
- Home
- HTML, CSS, AJAX
- Linux
- MS SQL
- MySQL
- Photography
- PHP
- phpBB
- Reviews
- Search Engines
- Snippets
- Software
- Ubuntu
- Windows
- Wordpress
Lifestream
-
Linley Gales commented on your link.— 9h ago via Facebook
-
Kelly Kerr commented on Emma Neve Neemo's Photo.— 1d ago via Facebook
-
Richard 'Flo' Ibberson commented on your photo.— 2d ago via Facebook
-
Vix Lucas commented on your photo.— 2d ago via Facebook
-
Michelle Symonds commented on her status.— 2d ago via Facebook
Tags
Recent Comments
- Dariush on Installing mod_evasive on cPanel and/or Apache
- nayasites on [Snippet] Stop Windows Update irritating you to restart after updates
- Geburtstagskarten on Managing User Shares in Windows
- Smelly Brain on What is the difference between ‘learnt’ and ‘learned’?
- MarcusTeaf on Convert phpBB IP Addresses