First of all, why to optimize its website Wordpress?
For several reasons:
- This allows you to increase its position in the results of Google and Yahoo search engines
- If your site is too long to load, you may lose your visitors
- Time saving
- Gain bandwidth
- Will your site be online longer if your site has just undergone a buzz (or ramdam, as makes me noted my dear Gibonk! :-)))
Here, I’ll develop 3 points necessary for the optimization of a site that uses Wordpress (also valid for the other sites):
- Optimization of the source code (Html, CSS, Javascript,…)
- All image optimization
- Optimization via caching
How to measure its performance?
En utilisant le site http://gtmetrix.com, site web qui donne une note de A (Excellent) à F (très mauvais) sur une page en analysant divers critères en se basant sur 2 algorithmes: celui de Google (Page Speed) et Yahoo (YSlow). You can also use Firebug + PageSpeed and YSlow Firefox addons.
For convenience, I advise you to use the excellent site Gtmetrix, registration not required, but if you register (free), you have the advantages to compare several sites (maximum 4 for now), to memorize certain results from site, to record the daily scores of a site. On the other hand, it is in English…
If your site has a score of green (A or B), be aware that your site is already optimized! If you get a C, you can be happy, it is already! After, also be aware that speeds and therefore the scores you get depend on several criteria, including some you cannot optimize, as for example pubs!
My side through all optimizations which follow, I went:
- for YSlow (Yahoo): 53% (E) 71% (C) => a gain of 18%!
- for PageSpeed (Google): 66% (D) 85% (B) => a gain of 19%!
Turn to optimization,
which is done quite quickly and easily:
1. Optimization of the source code (Html, CSS, Javascript,…)
The optimization of the source code is simply via a plugins that actually will do almost all the work: PHP Speedy WP
WP PHP Speedy will transform your Javascript and CSS files by unifying (to reduce the number of requests) and by compressing them (to reduce weight).
It uses “Minify”, “Gzip”, “Far future expires” and “Data Uris“.
Unzip it under wp-content/plugins /, activate it in your Wordpress administration panel, and put all the options to “Yes”, click on “Set options” then test your configuration and if there’s no problems, activate it!
The script exists for non-Wordpress sites: PHP Speedy
2. All image optimization
The image optimization is done via the Smush.it website, developed by Yahoo, the uploaded images are optimized by removing unnecessary bytes, you re – download and you have your optimized images! And above all, it is done without loss of quality!
There is a Wordpress plugins, but it does for the images in the category ‘Media’ gold it is no that there are images! Your theme and your plugins contain also images! (Icons, site, etc…)
I very strongly recommend that you optimize the images of your plugins (usually found in the folder “images” of each plugins.
I have managed to reduce the sizes of my pictures from 10-50%! Including an image to 83%!
3. Optimization via caching
Optimization via caching is done thanks to the well-known plugins WP Super Cache and grace to the .htaccess file.
For the plugins, nothing easier, unzip it into wp-content/plugins and activate it and set mode “ON” or “Half ON”. The mode “ON” is recommended but it is possible that the Super cache does not work in this case, put in “Half ON”.
To the .htaccess file, you insert:
<IfModule mod_headers.c=””></IfModule>
# Caching of images and other static file for a month
<FilesMatch “.(ico|jpe?g|png|gif)$”=””></FilesMatch>
Header set Cache-Control max – age = 2592000″
This allows to force caching of your images by the browser of the visitor to 1 month.
And voila, with all these tricks, you have what have a website much faster, and therefore a better positioning in Google!