Time is of the essence, especially for the people browsing the internet. If you have a website that takes forever to load, they will leave it without even taking a look. This is why you need to consider to improve its performance. Here is how to speed up your WordPress site using .htaccess file.
What Is .htaccess?
It is a file that allows you to configure a piece of the server (directory and subdirectories). It does require a bit advanced IT knowledge but you can do certain things even if you have limited skills. This is why we will show you how to speed up your WordPress site using .htaccess file.
First, locate your .htaccess file in the root directory of your server. You can open it with Notepad in order to modify it.
Another great way how to speed up your WordPress site using .htaccess file is to enable browser caching. This means that you tell the browser to keep some of the files. Next time your visitors need a certain file, it will load from their local drive instead of from the web server, increasing the speed of your website.
Simply add this code to your .htaccess file:
# BEGIN Cache-Control Headers <ifModule mod_headers.c> <filesMatch "\.(ico|jpe?g|png|gif|swf)$"> Header set Cache-Control "public" </filesMatch> <filesMatch "\.(css)$"> Header set Cache-Control "public" </filesMatch> <filesMatch "\.(js)$"> Header set Cache-Control "private" </filesMatch> <filesMatch "\.(x?html?|php)$"> Header set Cache-Control "private, must-revalidate" </filesMatch> </ifModule> # END Cache-Control Headers
Finally, once you finish editing, don’t forget to upload your new .htaccess file and overwrite the previous one.