Optimal Google Pagespeed Insights for WordPress

14 Oct Optimal Google Pagespeed Insights for WordPress

Google Pagespeed Insights is a set of standard measuring speed and ability by the friendliness of the website Google proposes. According to Google, the standards in Pagespeed Insights will focus on two main issues, such as page load speed and friendly user experience. And if the website has been rated sites Pagespeed Insights page, the page that means as much to meet Google’s standards set

In fact, the standards do not require you to apply because not all criteria that you can use in all cases. So if you watch this series and not be able to do a certain number of standards are just ignored, because Google does not force you to achieve all standards.

And now, Google Insights Pagespeed have all 16 evaluation criteria are as follows

Optimal speed rules

Avoid using landing page redirect.

enable data compression sent to the browser.

improving the response time of the server.

improved caching in the browser.

Compressed CSS and Javascript resources on website.

Compression reduces image size

Optimize the insert CSS in the website.

Set the priority order of content in the website.

Javascript and CSS unblocked when the page loads.

optimum efficiency rules

Avoid using the plugin to display the content.

Viewport configuration to display appropriate screen size.

Optimization of buttons or links on the website.

Use appropriate font to display the content.

Thus, if you want your website Google friendly Pagespeed then make sure that you have applied the rules above. So, how to apply, how to apply for WordPress? That is what I will guide you through the optimization tutorials Google Pagespeed Insights this.

The first criterion: Use appropriate host

If you currently use the free hosts do not follow this tutorial to do to bother, because it may slow its pace and less tech support should you be unable to do so many features. Therefore, I encourage you to use the best host for WordPress that encourage their names are A2Hosting (server Singapore), StableHost, Arvixe (with server Hongkong) are good hosts for WordPress, compatible with multiple plugin.

Also, I encourage you to use the service CloudFlare to optimize speed better website.

Avoid using redirects landing page

Redirecting means that when you visit a page that you re-establish it redirect to another page or another address type. This condition is most common with sites using the domain name type www.domain.com (www). That habit of many people, they just knock on your browser domain.com, should now webserver needs more time to it shifted to type www domain and delay for a few seconds.

Therefore, I encourage you not to use the domain name www user as it will take more time for navigation, as well as looking at the website address 3 characters long.

Enable compression

Compression function here means webserver will compress the data sent to the browser as gzip HTTP methods instead as normal raw data, this time the browser will display the content that has been compressed gzip. And so compressing can help you optimize speed multiplied by the size of each request was significantly reduced (about 50-70% after compression).

Check Gzip on website at: http://gzipwtf.com/

To enable gzip compression, you can do the following:

If use the Plugin W3 Total cache

You can enable gzip compression in Performance -> General Settings -> Browser Cache.

Enable gzip for “W3 Total Cache”

Then you on Performance -> Browser Cache and tick all of the options “Set Expires header”.

If use “WP Super Cache”

For “WP Super Cache” you can enable Gzip by going to Settings -> WP Super Cache -> Advanced and tick the option “Cache hits for quick access to this website. (Recommended) “and” Compress pages than they’re served more Quickly to visitors. (Recommended) “.

Enable gzip for “WP Super Cache”

For Apache

If you use Apache webserver without using two plug-in, it can be turned on by inserting the following paragraph gzip in .htaccess:

1

2

3

4

5

6

7

8

9

10

<ifModule mod_gzip.c>

mod_gzip_on Yes

mod_gzip_dechunk Yes

mod_gzip_item_include file.(html?|txt|css|js|php|pl)$

mod_gzip_item_include handler^cgi-script$

mod_gzip_item_include mime^text/.*

mod_gzip_item_include mime^application/x-javascript.*

mod_gzip_item_exclude mime^image/.*

mod_gzip_item_exclude rspheader^Content-Encoding:.*gzip.*

</ifModule>

Or if you inserted the paragraph above that defective 500 or without gzip is removed and used in the lower section.

1

2

3

4

5

6

7

8

9

AddOutputFilterByType DEFLATE text/plain

AddOutputFilterByType DEFLATE text/html

AddOutputFilterByType DEFLATE text/xml

AddOutputFilterByType DEFLATE text/css

AddOutputFilterByType DEFLATE application/xml

AddOutputFilterByType DEFLATE application/xhtml+xml

AddOutputFilterByType DEFLATE application/rss+xml

AddOutputFilterByType DEFLATE application/javascript

AddOutputFilterByType DEFLATE application/x-javascript

For Nginx

If you are using nginx without using plugin của WP Super Cache or W3 Total cache thì chèn đoạn sau vào tập tin nginx.conf:

This improvement means that the optimum speed of the host or your server is using. If you use the host, make sure your host has fast processing speed as the best host for WordPress. But if you use your own server / VPS, please track (can use Newrelic) to monitor whether the processor speed of the server slowly over time, and thus you can apply more ways to save other buffer data as Database Object Cache or Cache.

If you are using a private server or VPS, you should use “EasyEngine” or Centminmod to run WordPress to have the highest response rate.

Improved caching of Browser

By default when the browser loads the website, it will save data buffer (cache) static files such as images, CSS, even if your website content can enable gzip above. But if you do not optimize the time that is allowed cached browser, you will encounter the problem that too as fast cache or too long before, the optimum is you should call up the browser’s cache static files on your website is beautiful range of about 1 month.

To do this, we will need to declare a piece Cache-Control HTTP header and ETag into static files, examples of sulopa.com:

1

2

3

4

5

6

7

8

9

10

11

12

13

14

HTTP/1.1200OK

Date:Tue,14Oct201515:29:06GMT

Content-Type:image/png

Content-Length:112

Connection:keep-alive

ETag:"550032be-70"

Expires:Fri,13Jun202517:13:06GMT

Cache-Control:public,max-age=315360000

Access-Control-Allow-Origin:*

CF-Cache-Status:HIT

Vary:Accept-Encoding

Accept-Ranges:bytes

Server:cloudflare-nginx

CF-RAY:1f7824b54a4905b5-ARN

To view the HTTP Headers fast then you can go http://web-sniffer.net/ and copy a link to an image file, CSS and JavaScript on your site to check it had not yet header above.

Adding cache duration by CloudFlare

If you use CloudFlare on the website, you can set the expiration time of static files in Caching -> Browser Cache Expiration.

For “W3 Total Cache”

If you use “W3 Total Cache” when enable the “Browser Cache” (see above gzip compression), it has itself more time expires on the static file. But you can in Performance -> Browser Cache and mark the line as “Set entity tag (ETag)”, “Set cache control header”.

For Apache

If you do not use CloudFlare and W3 Total Cache that uses the Apache web server, you can add the following to .htaccess:

1

2

3

4

5

6

<ifmodule mod_expires.c>

<Filesmatch"\.(jpg|jpeg|png|gif|js|css|swf|ico|woff|mp3)$">

ExpiresActive on

ExpiresDefault"access plus 1 year"

</Filesmatch>

</ifmodule>

Or if isn’t, use a clip on the following segments:

1

2

3

4

5

6

7

8

9

10

11

ExpiresActive On

ExpiresByType image/jpg"access plus 1 year"

ExpiresByType image/jpeg"access plus 1 year"

ExpiresByType image/gif"access plus 1 year"

ExpiresByType image/png"access plus 1 year"

ExpiresByType text/css"access plus 1 month"

ExpiresByType application/pdf"access plus 1 month"

ExpiresByType text/x-javascript"access plus 1 month"

ExpiresByType application/x-shockwave-flash"access plus 1 month"

ExpiresByType image/x-icon"access plus 1 year"

ExpiresDefault"access plus 2 days"

For Nginx

If you use nginx, then add the following to the configuration file “domains” of “Nginx”:

At this point we have to understand the mechanisms through rating score “Google Pagespeed Insights” on the website, and we also optimize your website based on the first 4 standards in “Google Pagespeed”. In the next section we will continue to do other criteria.