WordPress PageSpeed optimization

Quite often turn to me with a request to “speed up site” – say, Google shows 50 out of 100, and because of this the site is lost in SERP.
In this lesson, we try to understand what determines speed of site and whether it is possible to achieve results from Google PageSpeed 100/100.
Let’s look at 10 points, which can mention Google.

1 – Reduce server response time

“In our test, your server responded in 1.4 seconds. There are many factors that can slow down your server response time.”
The servers answer is more than 0.2 seconds Google considers as slow, and if you see the message, you should be seriously concerned. In my opinion, the first step for optimization – make short page generation time. Without this rest of optimization methods are ineffective.

First you need to make sure once again that the problem is in the generation of the page. To do this, open the home page to view as html and save it on your computer as an index.html. Then move the file to the server, in the home directory of the site (usually www, http, public_html, etc) Then, need remove or rename the working file index.php (be sure to make a backup copy) and try again to pass the test PageSpeed ​​Insights.

If the message “Reduce server response time” moved from Consider Fixing in Passed Rules – be sure that you have to work on the speed of page generation. Perhaps your site uses a lot of queries to the database, or these queries unoptimized .
How to optimize the page generation speed, I will tell some other time (this is a very broad topic, and perhaps not for one article). Now we will continue to consider the other tips Google

2 – Leverage browser caching

Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network.
You can use “expires” for Nginx or “mod_expires” for Apache. If you used shared hosting rather than the server, you can use the file .htaccess. Please note that your browser cache should be used after all other items are made.

If you see such a message, it is likely that you use a lot of plug-ins, each of which downloads additional javascript files and CSS.

Possible solutions:
1 – integrate multiple files into one (note that this will have to be repeated every time you upgrade);
2 – load files JavaScript asynchronously, use the attribute “async”;
3 – load files JavaScript from the CDN. Here is a simple example that will load jquery with Google’s CDN and not from your site:

4 – load files JavaScript only where they are needed. Often (if plugins written by non-professionals) plugin connected to external files on all pages of your site. Agree, it’s silly – load files for validate forms on every page of your blog, if you use the contact form on just one page?
5 – load files JavaScript in the footer instead of in header;
6 – load files CSS using JavaScript, and only where they are needed;

4 – Optimize images

You can just take the pictures offered by Google. And further use only the optimized images.

5 – Enable compression

You can use the module mod_deflate for Apache, and you can use the static compression. Each of the methods has its pros and cons, and it must choose based on the task at hand.

6 – Minify JavaScript

Everything is simple. You can use any free application for minimize JavaScript. For example, my.
However, please note that JavaScript must be compressed, before enable caching and gzip-compression.
Also note that every time, after you update plugins, you must compress these JavaScript.

7 – Minify CSS

8 – Minify HTML

Minimizing HTML is not much different from the minimization of JavaScript or CSS.
In short, is the removal of spaces, blank lines and comments.

9 – Prioritize visible content

It is difficult to give a general advice for all sites. The main content should be visible without scrolling.
May have to reduce the height of the header of the mobile version or abandon the beautiful effects.

10 – Avoid landing page redirects

Everything is clear from the title.

At the end of the post I want to reassure those who have not achieved the result 100/100.
Result of 100/100 can be achieved only if not use external scripts (counters, banners, etc.). So if you have a result of 90/100 or higher, you do not need to worry – your site optimized.