Improve Your Google Page Speed Insights Score

Fortunately, there is a way you can test the speed of your website and get some advice on how to speed it up. It’s called Google PageSpeed Insights.

If you want to reduce and boost your website page loading time, then keep your close attention in this post as I am going to explain how to improve your google page speed insights score.

How to Leverage browser caching in WordPress using .htaccess

Create a .htaccess file in the root of your domain. You can edit the .htaccess file with notepad or any form of basic text editor. Include bellow code snippets in the .htaccess file.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

## EXPIRES CACHING ##

<IfModule mod_expires.c>

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"

</IfModule>

## EXPIRES CACHING ##

Enable gzip compression

You can enable Gzip compression using the .htaccess file.

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 mime^application/x-javascript.*

mod_gzip_item_include mime^text/.*

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

mod_gzip_item_exclude mime^image/.*

mod_gzip_item_include handler^cgi-script$

</ifModule>

Enable HTTP Compression

To Enable the HTTP Compression to use the following line of codes in your .htaccess file.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

# compress text, html, javascript, css, xml:

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

AddTypex-font/otf.otf

AddTypex-font/ttf.ttf

AddTypex-font/eot.eot

AddTypex-font/woff.woff

AddType image/x-icon.ico

Do you like & share this article with your friends, and don’t forget to follow us on Facebook and Twitter to learn cool WordPress tutorials.

About: Prem Tiwari

Prem Tiwari is the founder of FreeWebMentor.com and also a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies. View all posts by Prem Tiwari