Some WordPress optimization tips
Quick tips to improve WP performances
I’ve recently had to move my company’s WordPress-based site to a new server. This gave me the chance to do some little tweaks to a 2-year-old site. I focused on optimizing WordPress, to improve site’s performance while decreasing CPU and server load. Since I was able to reduce the load time of my company’s site significantly (I used YSlow to monitor performances), I thought to share the steps I followed, as I feel this might be helpful.
1. Install WP Super Cache plugin
You can download the plugin here – it’s pretty easy to setup.
The plugin itself does 80% of the work and helps a lot speeding up load times.
2. Add some .htaccess rules to force caching of static elements, such as css, javascripts and images.
I had the chance to attend to Fullo’s speech about WP optimization at last year’s WordCamp Italy, when he shared some really useful tips that I finally put into practice. He has posted the slides to his blog, with code snippets.
<IfModule mod_expires.c> ExpiresActive On ExpiresDefault "access plus 1 seconds" ExpiresByType text/html "access plus 1 seconds" ExpiresByType image/gif "access plus 2592000 seconds" ExpiresByType image/jpeg "access plus 2592000 seconds" ExpiresByType image/png "access plus 2592000 seconds" ExpiresByType text/css "access plus 604800 seconds" ExpiresByType text/javascript "access plus 216000 seconds" ExpiresByType application/x-javascript "access plus 216000 seconds" </IfModule> <IfModule mod_headers.c> <FilesMatch "\\.(ico|pdf|flv|jpg|jpeg|png|gif|swf)$"> Header set Cache-Control "max-age=2592000, public" </FilesMatch> <FilesMatch "\\.(css)$"> Header set Cache-Control "max-age=604800, public" </FilesMatch> <FilesMatch "\\.(js)$"> Header set Cache-Control "max-age=216000, public" </FilesMatch> </IfModule>
3. Add some .htaccess rules to enable compression of Html pages
This trick was suggested by my friend Luca, who also sent me the following code:
# compress all text &amp; html: AddOutputFilterByType DEFLATE text/html text/plain text/xml # Or, compress certain file types by extension: <Files *.css> SetOutputFilter DEFLATE </Files> <Files *.js> SetOutputFilter DEFLATE </Files>
4. Finally, add a robots.txt file to prevent unnecessary bot traffic
This was also suggested by Fullo’s priceless slides:
User-agent: * Disallow: /cgi-bin Disallow: /wp-admin Disallow: /wp-includes Disallow: /wp-content User-agent: Mediapartners-Google Allow: / User-agent: Adsbot-Google Allow: / User-agent: Googlebot-Image Allow: / User-agent: Googlebot-Mobile Allow: / User-agent: ia_archiver-web.archive.org Disallow: /
Before leaving you, here are some other useful articles I’ve found while googling around:
About this entry
You’re currently reading “Some WordPress optimization tips,” an entry on jek2kdotcom
- Posted on:
- 27.02.2009 @ 12pm
- Categories:
- WordPress
6 Comments | View
Come on, leave your feedback!