by Devin Yang
(This article was automatically translated.)

Published - 6 years ago ( Updated - 6 years ago )

What is PageSpeed ​​Insights?

PageSpeed ​​Insights is an analysis tool provided by Google, which analyzes and optimizes our website according to the so-called best practices of the website (Web Best Practices).
I can use his suggestions to optimize the website.

How to optimize?

The optimization type can be divided into the entire webpage structure and settings, including the optimization of webpage image files.
Since the hosting provider of the web hosting website I am currently using is Bluehost, and he uses Apache Web Server,
So here I share the .htaccess setting method used in my project, through the following setting can improve a lot of scores. ( optimized part )
After modifying .htaccess, please be sure to confirm whether it is feasible. Incorrect settings will cause the host to display a 500 error.
Very important , ExpiresDefault should be cached for at least 1 week, which made me add 10 points .

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.*


## EXPIRES CACHING ##

Expires Active On
ExpiresByType image/jpg "access 1 month"
ExpiresByType image/jpeg "access 1 month"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 week"
ExpiresByType text/css "access 1 week"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 week"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 week"

result

Here are the results of my crazy optimizations using PageSpped Insights.
finally electricity The brain version has 95 points.

Tags: web-hosting

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments