If you run your website through Google PageSpeed Insights or GTmetrix, you may notice it suggests leveraging browser caching or compressing components with gzip. Fixing these issues will significantly increase your website speed and improve the grades you get from Google and GTmetrix.
To fix these issues, WordPress has a multitude of free and paid plugins to accomplish your goals. Keep in mind, the more plugins you have on your WordPress website, the higher the chance you could potentially have an issue, ranging from getting hacked to having an update not be compatible with your website and taking it down. If you are running your site on an Apache server and have access to FTP, you don’t need any plugins at all, and I suggest not using any if you don’t have to.
Here’s how you can configure your website to be fast without plugins:
Get access to your .htaccess file
.htaccess is a configuration file for use on websites running Apache Web Servers. The .htaccess configuration file can be used to enable and disable functionality and features on the Apache Web Server. Doing this means that we can use this file to allow caching and gzip compression through the .htaccess file instead of using plugins.
To access the .htaccess file, you will need FTP access to your web server, an FTP client, and a text editor. For Windows, I suggest the FTP client WinSCP. For both Windows and Mac there’s an extensive collection of FTP clients, so feel free to find one that works for you. The text editor I suggest is Sublime Text, but any will work, including the default Mac and Windows text editor.
The location of the .htaccess file will be in your public_html folder – the folder that has your wp-admin, wp-content, and wp-includes folders.
*Note: When editing the file, start under the “# END WordPress” line.
Enable GZIP Compression
Add this code to your .htaccess file to enable Gzip compression.
Leverage browser caching
These two quick ways to enable gzip and caching will increase your page speed all while allowing you to stay free from plugins. WordPress plugins are great when necessary, but if they can be avoided, you should do so.
Note: The .htaccess file is a sensitive file. A syntax error could take down your website. Make sure you have a backup and make sure you use a text editor so you can easily undo changes in case something does go wrong.