WordPress speed optimization is a crucial factor and affects our search ranking and decrease user engagement.
According to a study, we only get 5 seconds to engage a visitor and 54 % of users don’t return to a site that is slow to load.
The excess use of plugins, themes, and unoptimized images can make your site heavy and slow to load.
However, some WordPress speed optimization and caching plugins can help you improve your page load time, but you can also speed up your site by adding some codes to the .htaccess file of your site.
Here I’ll be sharing the best .htaccess code to optimizing your WordPress site speed.
WordPress Speed Optimization With .htaccess
Adding this code in the .htaccess file of your site will fix the issue of Enable compression and Leverage browser caching.
To get started, use the file manager provided by your web hosting or use an FTP client like File Zila to access the root of your site.
Then you can see
.htaccess file there, backup that first then edit it and add the code below to it.
This code enables Browser caching and Gzip compression for your site.
When browser cache is enabled, in the initial load of your website, your website and its static files will be cached on the visitor’s browser. So, the next time when your page is loaded then most contents will be directly fetched from the browser cache and thereby speeds up your website.
Enabling Gzip compression will simply compress and reduce the size of your website. We tried this on our website with WP Super Cache enabled and found the results below.
As you see from the image, there is a little improvement but this depends on your theme and some external files may not be optimized with this code.
Mostly this code can give +10 score and beyond this, you can minify, use a cache plugin and use a CDN to get better results.
We will cover on a full WordPress speed optimization is upcoming posts, so stay tuned.
If you have any queries regarding this WordPress speed optimization guide then leave a comment below or ask the community here.