Website Speed Optimization 2020
Website Speed Optimization is essential for a website in 2020. Website speed is how fast your page loads when someone opens in a browser. It also considered as load time (the time it takes to load your content fully).
Speed Ranking Factor
Google has said that website speed is a ranking factor, and if your speed is low, then it will lead to low rankings, a high Bounce rate, and the visitor will not stay at your website. Also, Google might not be able to crawl and index your pages, and the conversion rate will be negatively affected due to high load time.
There are various tools available to check your website speed score and load time. Some examples are Pingdom, GTmetrix, and Google page speed insights tool.
Below are the ways to reduce the load time and speed up your website.
Enable Gzip Compression
Compressed files reduce the load time of your page and smaller files make your pages load fast. Enabling Gzip compression is the best practice to reduce file size. Gzip is a file format and software application for HTML, CSS and JavaScript file compression.
Many web servers compress files in Gzip format by default. If you want to check if your site has Gzip enabled, you can see in https://www.giftofspeed.com/gzip-test/. If your website in WordPress, you can use WP Rocket and W3 Total Cache plugins to enable Gzip.
You can also enable Gzip compression by your .htaccess file. You just have to place the following code in your .htaccess file.
<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>
Minify Files
You can minify your code by removing whitespaces, commas, and other unnecessary characters. You can increase your page speed by removing code comments, unnecessary formatting, and unused code as well. Useless piece of code increase the size of your page
Reduce Redirects
We should focus on reducing multiple redirects. Having too many redirects can create additional HTTP requests which will increase the wait and load time eventually. For example, if you redirect from example.com to www.example.com to https example.com, it will increase the load time because of multiple hops. You can redirect all the pages in .htaccess file to the most recent version of the URL.
Reduce Image Size
Images play an essential role in your site speed. They can increase the page load time if using large images. If your website is on WordPress, then you can use the WP smush plugin to compress your images. If you have a non-WordPress website, then you can use tinypng.com and compressor.io.
Leverage Browser Caching
When you visit a website, browsers store cache (page information) in your local drive, next time when you visit that website again, browsers don’t have to reload them again. To do this, you have to enable browser caching. If you have a WordPress website, you can use the W3 total cache plugin. You just have to go to the general setting and enable page cache and browser cache by checking the box.
If you don’t have a WordPress website, then you can place the following code in .htaccess file. The below code directs browsers what to cache and how long to “remember” it.
## EXPIRES CACHING ##
<IfModule mod_expires.c>
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"
</IfModule>
## EXPIRES CACHING ##