Use CDN – This allow users from a around the world to download static content from a closer source instead of spanning the Atlantic ocean to retrieve data.
Compress your JS, CSS, Images and HTML. The more compressed you get your scripts / images, the faster the download will be.
Get a faster hosting. Google also rank sites base on the amount of time spent to deliver your content to readers. According to Google, users tend to leave sites that take more than 3 seconds to load. So it’s important to to pick the right hosting for your website. Tip: new hosting sites are usually better because their servers are less crowded.
Leverage browser caching. I always use the following config to enable caching for specific types of file.
Enable Gzip Compression – Gzip Compression allows your web server to provide smaller file sizes which load faster for your website users. The code below should be added to your .htaccess file.
The code above will work on Apache. If it’s not working there is another way that may work for you. Remove the above code from your .htaccess file and try this one instead:
In my experience, enabling Gzip Compression gives you most of the score difference on Google PageSpeed Insights.
Combine CSS Files. Fewer HTTP requests for CSS content is better rather than loading a bunch individual CSS files.
Compress your JS, CSS, Images and HTML. The more compressed you get your scripts / images, the faster the download will be.
Get a faster hosting. Google also rank sites base on the amount of time spent to deliver your content to readers. According to Google, users tend to leave sites that take more than 3 seconds to load. So it’s important to to pick the right hosting for your website. Tip: new hosting sites are usually better because their servers are less crowded.
Leverage browser caching. I always use the following config to enable caching for specific types of file.
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
Enable Gzip Compression – Gzip Compression allows your web server to provide smaller file sizes which load faster for your website users. The code below should be added to your .htaccess file.
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.*
The code above will work on Apache. If it’s not working there is another way that may work for you. Remove the above code from your .htaccess file and try this one instead:
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
In my experience, enabling Gzip Compression gives you most of the score difference on Google PageSpeed Insights.
Combine CSS Files. Fewer HTTP requests for CSS content is better rather than loading a bunch individual CSS files.