How to increase website speed using htaccess WordPress?

5/5 - (19 votes)

How to Increase Website Speed using htaccess on WordPress: If you have a WordPress blog, or ecommerce website, on which you sell something, it can be anything, a digital product or a physical product and you are looking for “how to load fast wordpress site”. So in this article I am going to give you information about the same.

In this article, we are going to talk about many topics related to increase website speed. You can improve the speed of your website very well by carefully reading the article and following the steps given by taking a little time.

increase website speed using htaccess

Note: If you are using any ad network on your blog. So speed does make a difference, so don’t worry about it. Otherwise, if you are running an ecommerce website, then you must pay attention to the speed of your website.

Table of Contents

3 Negative Effects Of Having A Slow Website For Your Business

No one wants to visit a slow website. When we type a website address on our browser or click on a website link, we expect that site to appear on our screens instantly. Not 5 seconds or 10 seconds later, but right this very moment. That’s how spoiled we’ve become in the Internet age. 

Everything is within our reach thanks to massive improvements in Internet technology. So, when we land on a slow-loading website, we simply hit the back button and go check out another website. But how does having a slow website affect your business:

1. Fewer customers and clients

Since most people won’t have the patience to wait for your site to load, then you’re essentially left with those who have the patience of a saint. These are probably your most loyal customers, or those who have nothing better to do than wait for your site to appear on their screens.

But what about those who’ve decided to leave your site? What are you going to do to get them back? Well, you can’t do anything about them now. What’s past is past. So, what you need to do is learn from your mistakes and make sure your future visitors stay on your site.

2. Lower conversion rates

When you’ve got fewer people coming over to your website, then your conversion rates are also going to tank. Sure, you can implement the best practices to get people who do land on your site to follow your call to action, but at the end of the day, it’s still a numbers game. 

For example, if your standard conversion rate is 10%, then on average if you have 1,000 people over to your site in a month, then you’ll probably make about 100 sales. 

However, if you get 10,000 people on your site, then with your 10% conversion rate, you’ll get 1,000 sales. That’s a huge difference in numbers, so you’d obviously want to get people to stay on your site, not bounce away from it.

3. Lower rankings on Google and other search engines

One of Google’s metrics for ranking sites is page speed. This means they tend to give higher ranks to faster sites than slow-loading sites. As a business, you want your site to be on the top 3 spots on the first page of search results. These spots get the majority of traffic, so if your site is buried on the second page and beyond, then you’re not going to get much in the way of search engine traffic.

The 5 Common Culprits Of Slow-Loading Websites

Slow loading websites don’t do anyone any good. It’s bad for your business, and it’s bad for your visitors. In this article, you’re going to learn the top 5 culprits which cause websites to load slowly on people’s web browsers:

1. Unoptimized media files

When you upload unoptimized media files to your site, it puts additional strain on your server because it has to serve all those heavy files to your visitors. It consumes a lot of bandwidth and slows down your site considerably. So, what you need to do is to optimize your image files and your video files (these are the 2 most common media files uploaded to websites). 

2. Excessive HTTP requests

Every time someone visits your site, their browser sends an HTTP request to your web server asking it to send your files to them. Each file on your site is equivalent to one request. So, if you’ve got a lot of files like CSS, Javascript, and image files on your web pages, then you’re going to get excessive HTTP requests. To reduce this, you can use CSS image sprites and minify your CSS and JavaScript files. 

3. Too many ads

Ads are great for those who want to have an additional income stream for their site. You can sell banner ad space, you can sign up for Google Adsense and other similar ad programs.  However, each ad you serve on your site creates additional HTTP requests which can slow down your site’s loading times. Now, you don’t have to rid your site of ads – you just need to be selective and remember your users don’t go to your site to check out your ads.

4. Non-use of caching techniques

Caching your website files will help speed up your site. Instead of your server directly serving your files to everyone who visits your site (and thus causing performance issues), caching techniques put less stress on your server by serving up a static HTML file of your site. It makes your site load faster and your visitors happier.

5. Unclean code

Your website is a bunch of codes and files. When you have unclean code, you will inadvertently affect your site’s performance especially if one file conflicts with another file’s code. This is especially true in WordPress plugins. People install plugins left and right without realizing some don’t play well with others and can even cause their site to slow down.

5 Easy Ways To Improve Your Site Speed

You don’t need to feel down and dejected if your website’s running slow. It’s not the end of the world. Even if you don’t have a technical bone in your body, you can still get it done. 

Now, there are tons of ways to speed up your site, but in this article, we’ll only cover the easiest ways. You can always work on the more advanced methods later on. For now, you need a quick win and these easy methods will help you feel good about yourself and your business.

1. Choose a Good Web Hosting

A good web host can mean the difference between a fast and a slow website. Of course, looking for the best web host is easier said than done – there are thousands of them out there.

So, how do you know which one’s a good one? Well, you have to check out their reviews, you have to check out their packages and their guarantees. You should also test out their support because you’re going to need it down the line.

What Makes Web Hosting Essential For Your Site’s Speed?

If you think where you host your website doesn’t affect your site’s speed, then you’re sorely mistaken. When it comes to hosting, the saying, “you get what you pay for” applies. 

Signing up for the cheapest web hosting package you could find is not such a great idea. It’s like building your house on the sand and expecting it to withstand strong winds. If you want your site to succeed, then choose a reputable web host with reasonable prices. Your site will be in better hands. 

There are generally 3 kinds of web hosting: shared, virtual private server (VPS), and dedicated. 

  1. Shared Hosting

If you’re just a beginner and you’re just setting up your first website, then shared hosting is the way to go. It’s the cheapest option. Your site will be hosted on a server that’s home to other websites as well, maybe hundreds or thousands of other sites. 

Shared hosting is cheap because you’re basically renting space on a server and you’re dividing the server cost with other website owners. The downside is that when one of your server-mates or neighbors start getting popular (or gets hacked!), they’ll use up a lot of your shared server’s resources. All sites on that server get affected which often means reduced loading speeds.

  1. VPS hosting

If your site is starting to gain some traction and you’re tired of getting slower website speeds thanks to the limitations of shared hosting, then you may be ready for a VPS. 

While VPS is technically still ‘shared’ hosting, it’s a different kind of sharing. One physical server is divided into virtual servers. Each virtual server can only host a limited number of websites, and the resources are split evenly. This means that if you (or your neighbors) get a spike in traffic, then other sites are not going to get affected (which is what usually happens in regular shared hosting).

  1. Dedicated hosting 

If your sites get thousands of visitors daily, then shared hosting and VPS is not going to work for you. When you’ve got traffic numbers like this, then you need dedicated hosting. 

It’s the most expensive kind of hosting because you are renting an entire server. You’re not sharing it with anybody so you can customize it however you want, and you don’t need to worry about anyone stealing your resources.

2. Optimize your images

There’s no point in uploading a 5MB image if a 500KB version will look exactly the same. You can resize your image dimensions to, say, less than 2000 pixels. And with image compression, you can further cut down your image’s file size by a significant amount.

Best way to optimize images for wordpress Website And Increase:

Images add plenty of value to a website. Photos can make the difference between potential customers choosing to buy your products or not. Images help put a face to your brand or website. They help tell your story. 

The only downside to using images is that these are usually heavy files. If you’re uploading images straight from your camera, then your photos are going to contribute to your website’s slow loading times.

Since we’ve already established that photos are very important to sites, then you’re left with very little choice – either remove your photos or optimize them. Surely, you’re not going to choose the former since optimizing images is relatively easy. 

Here are 3 of the best methods to optimize your images for the web:

  1. Resize your photos 

You don’t need high-resolution photos for your website. In fact, if your images are anything above 2,000 pixels, then you should be optimizing it. This is because most computer screens only have 1080p resolution which effectively means 1920×1080 pixels. If your images are larger than that, then you’re just wasting your bandwidth.

To resize your photos, you can use a photo resizing tool like PicResize or download an app like FastStone. Once you’ve resized your photos, you can then upload to WordPress.

  1. Use the appropriate file type

There are many different file types for various images. Some are suitable for the web, while others are better suited for print. For web images, the 3 most popular image file types are JPG, PNG, and GIF. 

JPG images is a lossy compressed file format which works great for photographs like ones you take with your camera. PNG is a lossless compression file format which is great for graphics and images which require some transparency in it. GIFs, on the other hand, is also a lossless compression file and is often used in memes. However, the quality isn’t so great since its limited to 256 colors.

  1. Use an image compression tool

Image compression won’t change your photo’s dimensions, but it’s going to reduce the file size considerably. What it does is it strips your images of unnecessary metadata and additional color profiles which really don’t add to the image’s quality.  

A tool like TinyPNG is a great option. Alternatively, if you’re on WordPress, you can also use a plugin like WP Smush which works in the background and automatically compresses all image files uploaded to your website. 

3. Don’t upload your videos to your Host

If unoptimized images can go upwards of 5-10 MB and more, then you probably know that a 1-2 minute video can be upwards of 100MB. If your server has to serve your 100MB video, in addition to the rest of your website files, then you’ll have a stressed out server. What you can do instead is you can upload your video to sites like YouTube and Vimeo and just insert the embed code into your website.

4. Use a content delivery network (CDN)

A CDN will store a copy of your website files in many different server locations. For example, if your main server is in Texas and your site visitors are spread throughout the world, then your international visitors will probably find your site a bit slow. However, with a CDN, their browsers will be able to download your website files from a much nearer location which translates to faster download speeds. 

5. Remove unnecessary plugins on your WordPress site

It’s easy to get carried away with plugins – there’s so many of them to choose from! However, if you don’t want your site to slow down considerably, then you need to be selective with your plugins. Delete unused and unnecessary plugins, and you just may see a bump in your website speed.

4 Tools You Can Use To Measure And Improve Your Site’s Speed

You checked out your site on your desktop computer, and you said to yourself, “Well, this was awesome, my site is fast” But, then you go on to another computer, and your site suddenly became slow. 

So, how do you know exactly how fast your site is? 

Well, you can use any of these four free tools to assess your site’s speed and get actionable tips on how to improve it.

1. Google PageSpeed Insights

Since Google is the top search engine in the world, then you should obviously care what Google thinks about your website. So, your first stop is Google’s very own PageSpeed Insights which will measure your site’s mobile and desktop speeds. 

You get a score for page speed and optimization. Scroll down a bit, and you’ll have a bunch of optimization suggestions. If you can implement all the suggestions, then your site will have a much better chance of ranking high on Google.

2. Pingdom

Pingdom is another great tool to measure your site’s speed. Just like Google PageSpeed Insights, Pingdom will also give you useful suggestions to improve your site. 

You can choose from 4 locations (Melbourne, New York, San Jose, Stockholm). You get a grade for your site’s performance, and the waterfall chart makes it easy for you to spot and identify performance bottlenecks. 

3. GTMetrix

GTMetrix is another popular tool to check your site’s speed. Simply type in the URL of the page you want to analyze and hit enter. While free users can’t choose the server location (default is Vancouver, Canada), you’ll still be able to get plenty of ideas on how you can improve your site. 

GTMetrix gives you a comprehensive analysis from PageSpeed Insights and YSlow. What’s also great about this tool is that the recommendations are sorted according to the impact it has on your site. So, you should work on the recommendations at the top of the list first and work your way down.  

4. KeyCDN Website Speed Test 

Last, but not least, we have KeyCDN’s speed test tool. It doesn’t give a performance grade like the other tools on this list. However, it will give you a waterfall breakdown of your site’s requests. 

To know the details of each specific request, click on the request name itself and you’ll see the request header, response header, and meta information. If you want to see your site’s page size and the time it took for the entire page to load, just scroll down and you’ll find the information you’re looking for.

4 Must Have WordPress Plugins For A Speedy Website

There are literally thousands of plugins you can choose from for your WordPress website. But it doesn’t mean you should go and install every plugin out there that catches your fancy. That’s just going to slow your website down especially when you get plugins conflicting with each other. 

Resolving plugin conflict is a time-consuming endeavor, so it’s really not going to help you out with speeding your site. When it comes to plugins, more doesn’t equal speed. You only need the essentials. Here are some of them:

1. Caching plugin

A caching plugin will help your site load faster since your server won’t be serving your website files everytime someone lands on your site. Your plugin will help minimize your server’s workload.  While there are quite a number of good caching plugins out there, the most popular ones are:

2. Lazy load plugin

Lazy loading basically means not loading your entire website all at once. If you’ve got long articles peppered with images and video, your site will be slower than normal. That’s because your server has to send all the files at once. 

With a lazy loading plugin, however, your browser will only show above-the-fold content first. The rest of your website will be only shown when your visitor scrolls down the page. This effectively helps save bandwidth as well as speed up your site in the process. Some of the top lazy load plugins are:

3. Minification plugin

Minification is one of the best ways to optimize and make your WordPress site run faster. All unnecessary characters in your HTML, CSS and JavaScript files are removed. This reduces the file size and consumes less bandwidth to transmit. Some of the top minification plugins are:

4. Image compression plugin

If you upload lots of images to your site, then you can certainly benefit from an image compression plugin. For best results, however, it’s best if you resize your photos first to make it optimized for the web. 

This means if you’ve got images that are more than 2000 pixels, then it’s best you resize it to a size less than that. Your image compression plugin will then remove all the unnecessary metadata and unused colors from your images. Here are some of the top image compression plugins for your consideration:

You’re free to download and test the different plugins mentioned in this list, however, make sure you only choose one from each category and delete the rest, so you don’t slow your site down.

How To Decrease Your Page Load Times Using Htaccess?

Increase website speed using htaccess: If you’ve built your site on WordPress, then you can pretty much use only plugins to help speed up your site (provided you don’t go plugin-happy and install every plugin you find interesting). However, there are still some advantages to editing your .htaccess file directly instead of installing another plugin. 

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: 

  • Create the .htaccess file from scratch if you don’t have it yet, or 
  • You’re going to edit the .htaccess file.

To do either, you need to access your website files using an FTP client like FileZilla, 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.

How to Use .htaccess to speed up your site? (5 Step)

Here are some of the speed-inducing features you can activate using .htaccess:

Step 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.

Step 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.’

Step 3: Disable ETags

ETags, also known as Entity Tags, help web servers and browsers check if the cached browser content is the same as the one on the server. They are like special codes that identify a particular version of a component. These codes are enclosed in quotes. The server uses the ETag response header to tell the browser about the component’s ETag.

Step 4: Deny Spam Bots Access

Sometimes, the page load speed can be affected by the bandwidth available on your hosting plan. If your site shares a server with others, it may slow down even more due to spam bots crawling your site. To prevent this, you can either block or redirect the spam bots, but be cautious as redirecting them may also slow down the site loading.

Step 5: Enabling Keep Alive

It’s a way for the webserver to talk to the browser and say, “Hey, you don’t need to ask for every single file separately when you visit my site.” This way, the browser can grab multiple files at once, reducing the wait time. But before you go adding the code, double-check if your webserver already has it enabled by default.

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.

Should you shorten your website code to increase speed?

Whether you code your website from scratch or you use a content management system like WordPress, your site can benefit a lot from minifying your HTML, CSS and JavaScript files. 

This is because when developers code they try to make the code as easy on the eyes as possible. They add white spaces, or they type code on new lines, so it’s easier for them to read. 

Coders also add comments to specify what a particular section of code is for. When there’s a problem with the site, they can look at the code and trace where the problem is. 

Now, with computers, it’s a different thing. Computers don’t care for white spaces, new line characters, comments or block delimiters. They only care about the actual code itself. 

When you minify your site’s code, it’s essentially stripping away all the unnecessary details that are not going to affect your site’s performance. 

In an unoptimized CSS file, you may have thousands of lines of code, however, when it’s minified it’s going to put everything on a single line.

How do you minify code?

You can either minify by hand, or you can use a tool to help you with it. 

Naturally, when minifying by hand, it’s not going to be easy and will be very time-consuming. This is because you’re going to be manually removing all those spaces and comments and unnecessary characters. If you’ve got a thousand lines to work on, then you’ll be squinting at your screen for hours.

The good news is there are many tools you can use to minify your code. You can try using Minifier, Will Peavy’s Minifier, or any other minification tool you like. 

You simply need to copy your code, hit the minify button, and voila. You’ll have your minified code read to be copied and pasted to your site.

With WordPress, you can simply install a minifying plugin, set it up and let it get to work. Here are some of the top minification plugins:

  • Fast Velocity Minify – this plugin will help reduce the number of HTTP requests by merging your CSS and JavaScript files into groups.
  • Minify HTML –  this plugin will help clean up your HTML code which, in turn, will help speed up your site. 

Use any of the techniques mentioned in this article and watch your page load times decrease significantly.

Why People Hate Slow Websites?

Admit it – you hate slow websites, too. So, if you’ve got a slow-loading site, then expect people to hate it, too. But why exactly do we hate slow sites? 

Back in the early days of the Internet, websites literally took forever to load, and people didn’t complain (or if they did, they suffered in silence). People waited patiently for web pages to load and occupied themselves with other things until the entire page appeared on their screens.

Nowadays, when people land on a website that takes longer than 3 seconds to load, they impatiently click on that back button or close the tab altogether. Here are some reasons why people hate landing on slow sites:

1. There are far too many choices

There are billions of websites on the Internet. If one site is slow, people will just head on over to the next site. Why bother waiting when another, much faster website offers pretty much the same information? It may seem like we’ve all become entitled to getting our way, but this is the sad truth. We’ve become spoiled by the sheer number of choices we have and the speed by which we can access those choices. 

2. Waste of your visitor’s time

Time is precious. Every second we wait for a page to load is time wasted. You can’t take time back. Once a second’s passed by, it’s gone. We want to make the most of our time, so when we encounter slow sites, it feels like that site is not respecting our time. 

So, we leave that site and look for another one that will value our time. This is especially true if we’re looking for time-sensitive information where a few seconds can literally mean the difference between life and death or success and failure. 

3. Waste of their money

Most people who’ve got a cap on their data aren’t happy with slow websites. This is because slow websites consume their bandwidth. If they go beyond their allotted bandwidth for the month, they get charged extra. If you were in their position, you wouldn’t be happy too. 

4. Bad user experience

A slow site leaves a bad taste in your customer’s mouth. People click on your link because they want to go check out your content, but since your site is taking forever to load, then they’re not going to want to stick around. They wouldn’t even want to come back for a second visit.


Optimizing your website speed using .htaccess can significantly enhance user experience and SEO rankings. By leveraging .htaccess directives, such as browser caching, gzip compression, and Keep Alive, you can reduce load times and improve overall performance. Remember to handle .htaccess files with caution, as incorrect configurations may lead to issues on your website. Regularly test and monitor the changes to ensure a faster and smoother browsing experience for your visitors.

FAQ’s on increase website speed using htaccess

How to increase website loading speed in wordpress?

To boost WordPress website loading speed, optimize images, use caching plugins, enable GZIP compression, and leverage a content delivery network (CDN).

What is .htacess? How could we work on this file for an SEO prospective?

.htaccess is a configuration file that can enhance SEO by enabling clean URLs, setting redirects, and implementing caching and compression techniques.

How to improve your site speed through htaccess?

Optimize site speed via htaccess by enabling browser caching, compressing files, and leveraging expires headers to reduce server requests and improve load times.

Sharing Is Caring:

My name is Pradeep, I tell you YouTube, blogging, digital marketing and how to earn money online with my 5 years of experience.

Leave a Comment