When you use plugins, you run the risk of installing a badly-coded one which could potentially undo all your hard work. A bad plugin can cause conflicts, and you can lose some important functions on your site. And, of course, it can also cause some speed problems with your site.
With .htaccess, however, you get the benefit of not having another plugin to install. Plus, it’s also processed faster by your web server. This helps make your site run faster.
Now, touching the .htaccess file may not be as easy and as simple as installing a plugin. With .htaccess, you’re going to get your hands dirty, so to speak. That is, you’re going to need to either:
(1) create the .htaccess file from scratch if you don’t have it yet, or
(2) you’re going to edit the .htaccess file.
To do either, you need to access your website files using an FTP client like FileZilla (https://filezilla-project.org), or if your web host has cPanel access, you can use the file explorer. Make sure you activate the hidden files option. Otherwise, you won’t be able to see your .htaccess file.
Here are some of the speed-inducing features you can activate using .htaccess:
1. Enable Gzip compression
Gzip compression simply means your web server will be zipping up your files before it gets sent over to your visitor’s browser. Gzipping can significantly reduce your website file size which directly translates to faster website speed.
2. Enable browser caching
When you have browser caching on, specifically the Expires header feature, then your visitor’s browser won’t need to contact your web server anymore if the website files are still within their ‘expiration date.’
The browser will first check its cache, and if your website files haven’t ‘expired’ yet, then it’s going to be serving up those files to the user. Since the cached files are stored on the user’s computer, then that will make your site load faster on their browser!
Just a word of caution though, if you don’t know what you’re doing with .htaccess, then it’s best to seek assistance from an expert.