Every webmaster or blogger has one common goal and that is to speed up their blog as much as possible without sacrificing any existing element such as attractive theme, image or useful plugin. Nobody’s is denying the fact that looks, presentation or appearance also play important role in blogging. But in most of the cases, they are the prime reasons of a slow loading blog if not maintained sophisticatedly.
Here are the some dreadful effects a slow loading blog can cause us:
Negative user experience.
Drop of sales.
Getting penalized by Google and other search engines causing down slide in SERP. (Blog loading is one of the algorithm factors)
You may be thinking, despite having a well coded theme and a great web hosting, why am I still witnessing sluggish website performance in terms of loading?
Well, there could be plenty of small reasons behind it which combined together may be heating up your blog loading time. Some of them are strictly technical and critical steps need to be taken to get solved and some of them are really easy to fix. Let me give you a small practical instance to understand it better.
Suppose you scattered things in the middle of a room and you need to pick something which lays other part of the room. So you have to go there zigzag way to get that thing. If you had a clean room you could go there straight which would have certainly saved some precious moments.
Your website runs exactly the same way. At the beginning when your website is fresh you would be getting great performance. But when it starts getting old along with plenty of posts, revisions, images, theme alteration, and bulkier website database, it will naturally get slower and pain would be higher if they are untidy or scattered all over the place. When a visitor comes to your website, server has to solve several requests to serve what has been asked by the visitor. If you are looking for better site performance, you have to arrange things in order which will help your server to perform better.
Must read: How to Speed Up & Secure WordPress Blog With Fre CloudFlare CDN.
You got to take action to set up some rules which will automatically put things order. You need to perform some periodical maintenance processes such a database management, optimization of images, checking and clearing log errors etc. As of now, let me show you how to speed up WordPress site using .htaccess file. And if you want to drag your website loading time below 1 second, then read my extensive article: Ins and outs guide to reduce blog loading time.
Let me tell you beforehand, what you would be doing with .htaccess file. You have to include or modify some codes inside .htaccess file which could be found in your hosting account domain main root directory.
Understanding .htaccess file. What is .htaccess?
A .htaccess (hypertext access) is one of the main critical configuration files which basically has the remote power to control directories or sub directories inside the same parent directory it is located.
Well, in layman’s word .htaccess is used for:
Rewriting URLs in website.
Create 301 Redirect.
Password protect directories.
Disabling hot linking.
Blocking the door for spammers.
Cache Control using apache server feature.
In this post I am only showing how to speed up WordPress site using .htaccess but you can take a look at my other post where I have explained what else you could do with .htaccess file.
How to speed up WordPress site using .htaccess:
I know most of you are already advance blogger and know how to handle cPanel but still I will start from right at the bottom with ‘how to locate .htaccess file in cPanle’. I made this small video in which I have shown every possible steps in details to speed up WordPress site using .htaccess.
Caution: Take a backup of your .htaccess file, so if anything goes wrong you can revert back to the original!
1# We will start with Gzip compression:
I guess you already know the concept of gzip and you may have already used this method compressing a large files into smaller ones. Here we will follow the same method and will give sever command to gzip or compress files before sending to visitors. By compressing we can significantly reduce the file size resulting lesser bandwidth use and better server performance.
It’s really easy to take the benefit of GZIP. Just place the below mention code before the ending of .htaccess file. If you are not sure exactly where to paste this code, please watch the above inserted video.
*** Note: If your website returns with 500 internal server error that means mod_gzip module is not enabled and you need to ask your web hosting service provider to enable that.
2# set Browser Caching and expiry headers:
When a visitor steps into your website browser has to fetch each and every file such as CSS styles, texts, script and images. Naturally server has to solve lot of requests but if we set some feature like Browser Caching and expiry headers it will be lot easier to present the database for the returning visitors. Besicallt this command gives instruction to browser to store some particular files for a specific stipulated period of time. So when a visitor comes back browser itself can present those files instead of sending them to server resulting quicker website loading. This is one of those critical elements you got to set for better website performance.
There are two codes you actually need to paste in your .htaccess file. One is, setting the expiry date limit for browsers, means till when browsers should hold back the cache data.
# BEGIN Cache-Control Headers<ifModule mod_headers.c><filesMatch “\.(ico|jpe?g|png|gif|swf)$”>Header set Cache-Control “public”
Header set Cache-Control “public”
Header set Cache-Control “private”
Header set Cache-Control “private, must-revalidate”
# END Cache-Control Headers
And second is header expiry date limit.
# BEGIN Expire headers<ifModule mod_expires.c>ExpiresActive OnExpiresDefault “access plus 5 seconds”
ExpiresByType image/x-icon “access plus 2592000 seconds”
ExpiresByType image/jpeg “access plus 2592000 seconds”
ExpiresByType image/png “access plus 2592000 seconds”
ExpiresByType image/gif “access plus 2592000 seconds”
ExpiresByType application/x-shockwave-flash “access plus 2592000 seconds”
ExpiresByType text/css “access plus 604800 seconds”
ExpiresByType text/html “access plus 600 seconds”
ExpiresByType application/xhtml+xml “access plus 600 seconds”
# END Expire headers
Over to you:
Blog loading time is very crucial matter for every blogger. Almost every one who is in WordPress platform use cache plugin like W3 total cache or Super cache to reduce blog loading time. But these plugin themselves take almost half of a second to load. So instead of using these plugins you can edit and add codes in .htacces files to avail speed benefit. By using above mentioned code you can significantly speed up WordPress site using .htaccess. Please let us know whether it actually worked for you or not.
Hello friends, This is me Saikat, the co-founder of this blog. An investment consultant who eventually turned into a professional blogger. Feel free to connect me on Google+. You can follow my post on Twitter