19 Ways to Make Your Website Load Faster

fast

Speed is a Ranking Factor

A fast loading website matters. If you’re Google or Bing (or other search engines), you want to give the best results possible, right? If not, people will start going to other search engines for better results. Google knows this so they test every website’s speed and that’s a ranking factor.

Since speed is a ranking factor, that’s good news – it’s something you can control and it’s something you can fix. There’s no guarantee that you’ll rank #1 but your rankings should improve if you can make your website load faster.

This is Technical Stuff But Don’t Give Up

Some of the tips here are technical – well, a lot of them are. You may need someone good with websites working on your website apply these changes to make it load faster but I challenge you to give it a try. Once you try, you’ll learn. Sure, doing some of these things the first time will take time but once you learn it, it’s easier the next time and the whole concept of working on your website suddenly seems easier.

That’s how I got into website design and programming – I mainly taught myself. It took some trial and error and asking others for help but now I’m the one people come to for help.

You should be able to accomplish a lot of what I list here using your website’s hosting control panel. Most website hosting uses cPanel and in it, you have access to files on your website using the File Manager.

First Check Your Load Speed – Benchmarking

stopwatch-img-150There are 2 reasons to check your current load speed before we get started. First, you need to know where things are at. Second, you can run the test after every change and check the improvement. It’ll be good to record your scores at the start and with each step, so get out some paper or use Notepad on your computer and start keeping track of what you did and the scores.

There are 3 main tools to use to check site speed online and here they are:

  1. Pingdom Website Speed Test (tools.pingdom.com)
  2. GTmetrix (gtmetrix.com)
  3. Google PageSpeed Insights (developers.google.com)

We will mainly focus on the first two but do keep an eye on your Google PageSpeed Insights score as we go and see if there’s any improvement there.

When you run each test, wait for one to start before doing the next one. For example, I have 3 tabs in my browser open with each speed test so that I can just reload them but I’m waiting for one to end before I start another test in another browser. That way, I’m not loading down the site and skewing my results. Granted, web server loads aren’t consistent but I’m trying to control as much as possible for the best results.

How to Make Your Website Faster

Ok, got your benchmarks done (starting scores)? It’s on to the tips!

After you apply each step here, go to your website and do some testing. Make sure pages load correctly. If you paste in something wrong, it could mess things up. It’s also a good idea to take a backup of all files you’re modifying in case you need to roll back your changes.

1. Turn on Compression

What compression does is dynamically zip and then unzip content (text, images) as it’s being delivered. It can make a pretty big impact on some sites, so it’s worth turning on. Your website host might not have it turned on by default, so it’s up to you to do it.

Go to your website files (using FTP or the File Manager in your hosting control panel) and edit the .htaccess file that should be in the root (main folder) of your website. Make sure you’re viewing hidden files. If that file isn’t there, you can create it as it’s just a plain text file.

Add this code to the .htaccess file if it’s not there:

# Begin Enable Compression
 <IfModule mod_deflate.c>
 AddOutputFilterByType DEFLATE text/html text/plain text/xml application/xml application/xhtml+xml text/css text/javascript application/javascript application/x-javascript
 AddOutputFilterByType DEFLATE application/x-httpd-php text/php text/html text/plain text/css text/xml application/x-javascript text/javascript application/javascript text/x-js
 AddOutputFilterByType DEFLATE text/html text/xml text/css text/plain
 AddOutputFilterByType DEFLATE image/svg+xml application/xhtml+xml application/xml
 AddOutputFilterByType DEFLATE application/rdf+xml application/rss+xml application/atom+xml
 AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript
 AddOutputFilterByType DEFLATE application/x-font-ttf application/x-font-otf
 AddOutputFilterByType DEFLATE font/truetype font/opentype
 </IfModule>
 BrowserMatch ^Mozilla/4 gzip-only-text/html
 BrowserMatch ^Mozilla/4\.0[678] no-gzip
 BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
 Header append Vary User-Agent
 # End Enable Compression

With the code above and with other code snippets you’re adding to your .htaccess file, a line starting with a pound sign / hashtag means it’s a comment. Putting a start and end of a section helps make the file more readable. Also, returns at the end of each line matter, so make sure they’re in there – just don’t put all this code on one line or it won’t work.

2. Enable Browser Caching

Also in your .htaccess file, add this chunk of code/text somewhere:

## EXPIRES CACHING ##
 <IfModule mod_expires.c>
 ExpiresActive On
 ExpiresByType image/jpg "access plus 1 year"
 ExpiresByType image/jpeg "access plus 1 year"
 ExpiresByType image/gif "access plus 1 year"
 ExpiresByType image/png "access plus 1 year"
 ExpiresByType text/css "access plus 1 month"
 ExpiresByType application/pdf "access plus 1 month"
 ExpiresByType text/x-javascript "access plus 1 month"
 ExpiresByType application/x-shockwave-flash "access plus 1 month"
 ExpiresByType image/x-icon "access plus 1 year"
 ExpiresDefault "access plus 2 days"
 </IfModule>
 ## EXPIRES CACHING ##

GTmetrix says that doing this is a very important factor.

3. Make Sure KeepAlive is Enabled

As long as we’re working in the .htaccess file, add this code in as well:

# START - KeepAlive Enabled
 <ifModule mod_headers.c>
 Header set Connection keep-alive
 </ifModule>
 # END - KeepAlive Enabled

4. Use a Page Caching Plugin

When you use a plugin (I’m talking mainly to WordPress website owners here), your pages are turned into static files, which are faster to load since there’s no database connection needed to fetch the content that should be on each page. Each page is already made. These caching actually work really well. One that I like is called Comet Cache because it’s really simple to install and use – just turn it on.

I was using the caching that came with the WordFence plugin and I just switched this website to Comet Cache. I got this warning:

As of December 1st, 2015 Comet Cache requires PHP 5.4 or higher. Your server is currently running PHP v5.3.3. You will need to upgrade to PHP 5.4 or higher to run this version of Comet Cache.

And that brings up a good point – try to use a later version of PHP on your website if you can. What I did was, I went into my hosting control panel and changed the version of PHP from 5.3.3 to 5.5.33.

I installed Comet Cache, activated the plugin and went into the setting and enabled it with the default settings. I then opened another browser where I wasn’t logged into my site and pulled up the home page to make sure there was a cached version saved.

5. Optimize the Database

Since we’ve enabled the caching plugin, this won’t matter much because all the pages on our website are now being put into files but this is a good idea to do so that if new pages are added or the cache is cleared, creating new pages for the cache works faster.

A good plugin to use is called Optimize Database after Deleting Revisions (for WordPress). Here are the results I got:

db-optimize

I saved 2.2 MB which isn’t tons but it’s still something. I’ll take it. When the database is cleaner, things will work faster as there’s less to sort through. This, unfortunately, really matters with WordPress (right now).

6. Minify CSS and JS

That means make the CSS (cascading style sheets) and JS (JavaScript) files your website uses smaller. There are a lot of plugins available to do this. The most popular one is called W3 Super Cache, which takes care of caching and a lot of stuff. There’s a bit of a learning curve with that plugin, so to make things simple, I’m using one called WP Super Minify which is easy to install and use.

7. Optimize Images

Images take up a lot more room than the room we’ve been trying to save so far with making text files smaller – that’s just a fact. The next logical step is to optimize all the images that are on your website. Don’t worry, doing this is actually not too difficult.

Ideally, when you upload new images to your website, you should run them through optimizilla.com first. But what about the images you already have on your website? The EWWW Image Optimizer plugin (WordPress) does a nice job optimizing the images that are already in your media library. Just run the “Bulk Optimize” process once you have it installed. It’ll run for a while (depending on how many images you’ve uploaded) and make images smaller for you, which will reduce load time.

8. Your Website Host

cloud-dataHaving a fast website is also going to matter a lot. You definitely want a host that is using SDD, which stands for solid state drives. They are hard drives with no moving parts – think about the hard drive in your smart phone or those external flash drives (thumb drives) that are available. You can get terabytes of storage using solid state drives now and they’re reliable. Doing this really reduces the I/O (input output) bottleneck that servers using standard hard drives have to deal with. You can get a 40% increase or more in speed pretty easily by going to a website host that uses SDD.

I really like A2 Hosting because they use SDD and they do tuning for WordPress websites. They are WAY better than HostGator (don’t ever use HostGator). I’m already on a host with solid state drives but if you’re not, you will want to switch – it’s worth it.

Benchmark Your Hosting – Is Your Current Hosting Good?

If you want to find out if your hosting is good, post a basic HTML file on your website with just a few words on it – either create the page and upload it or use the File Manager in your hosting control panel. Just create a file with this in it:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
 <title>Benchmarking Page</title>
 </head>
 <body>Benchmarking Page</body>
 </html>

Next, use the benchmarking tools (Pingdom, GTmetrix and PageSpeed) to test that basic page. You should get top scores. If you don’t, then your hosting is not good at all – change your host immediately.

9. Switch Your DNS to a CDN ASAP

Is that enough acronyms for you? Basically, a CDN is a Content Delivery Network. You can get an account at CloudFlare for free and they take care of this for you. You’ll have to switch your DNS to them but for all that you get, it’s worth it. They not only speed up your website, they help protect against denial of service attacks and there are other benefits as well.

10. Reduce the Amount of WordPress Plugins

Make sure all the plugins you have installed and turned on are ones you need. If there are any you do not need, deactivate them and delete them. Even plugins that are turned off have been known to still be running sometimes. And the less files you have on your website, your chance of being compromised goes down since less can be hacked.

When you turn off unused plugins, there are less files involved. Each plugin adds more JavaScript and/or CSS files to your website and your website becomes bloated. Turn off and delete the ones you’re not using.

11. Consider Changing Your WordPress Theme

The theme you’re using could be very bloated. The best themes are ones that are really minimal. On my site, I’m using one from MyThemeShop called Schema and it’s very lightweight, so it loads quickly. Consider going to a paid theme done by a developer that has really good reviews.

You can even set up a test version of your website and then test your load time using different themes. See which theme works the best and then see if that’s one you can use for your website. If you have a theme you really love and want to use it, then find a website design company that has programmers that a knowledgeable with tuning websites and themes. They can most likely restructure the theme you like to run faster.

12. Clean up Your 404 Errors / Bandwidth

There are a number of things that drain your bandwidth and the next few items will touch on that.

Think about bandwidth as a pipe and data is the water going through it. When the pipe is big and there’s not a lot of water, everything moves through quickly. When the pipe gets full, then things don’t move so quickly. You want to make sure there isn’t unnecessary traffic going through that pipe so that everything runs smoothly.

When you clean up broken links, you’re making sure people aren’t going to pages that don’t work anymore. You’re also keeping your website visitors happy and your website looks better to Google and other search engines.

The way to clean up broken links on your website is by using a broken link checker. Google Search Console tells you some of this info but the one I like to use is called just that: Broken Link Checker. You install it and it runs a check on all your posts and pages right away. You’ll get a report when you go to Tools > Broken Links.

Fix all those links to keep your website running smoothly and reducing bandwidth.

13. Reduce the Number of Redirects

Another bandwidth hog is redirects. They can either be in WordPress or in your .htaccess file. If you want to get some in-depth analysis of your website, try the Screaming Frog software. You run it on your computer and it gives you lots of stats and details about your website – including how many redirects are happening.

There is, however, one redirect you do want in place as it’s important. It ensures that there’s only one version of your website available, not two or more. I cover that in my book: Getting Traffic: SEO for Small Business. And that book has a lot of tips for cleaning up your website and getting search engines to like it more. In turn, you get a website that runs more smoothly, which includes some speed improvements.

14. Tune Your Web Server

If you happen to run your own web server, there’s a number of things you can do to make it run faster. Of course, good hardware matters but there is also some software you can run. There are caching engines like Nginx and Varnish, which can be installed to speed up your website pretty dramatically. You do have to really know what you’re doing when you use that software but it can really speed things up a lot.

15. Reduce the Number of HTTP Requests

This is the number of requests your page has. When you run the Pingdom report, it gives you this number. As you do some changes mentioned here, you may notice that number decreasing. If so, that’s good. You want that number as low as you can get it. You do this by changing your theme to something more lightweight or reducing redirects or combining JavaScript and CSS files, turning off plugins and so forth.

16. Turn off Pingbacks and Trackbacks (WordPress)

Pingbacks are kind of old. I don’t know why WordPress still has them enabled, really. It’s when someone links to a page on your website, you get a notification about it. You can even have the page say where it’s getting links from. I guess it used to encourage people to link to you but if you have that enabled, you’re essentially giving people a way to get a link on your website for free. And it’s also taking up bandwidth. This isn’t needed, so turn it off.

Here’s some good code to put in your .htaccess file to turn off pingbacks/trackbacks:

# XML-RPC DDoS & TRACKBACK/PINGBACK PROTECTION
 # Using this code blocks Pingbacks and Trackbacks on your website.
 # You can whitelist your IP address if you use A Weblog Client
 # or want to whitelist your IP address for any other reasons.
 # Example: uncomment #Allow from x.x.x. by deleting the # sign and
 # replace the "x.x.x." with the actual IP address. Allow from 99.88.77.
 # Note: It is recommended that you use 3 octets x.x.x. of your IP address
 # instead of 4 octets x.x.x.x of your IP address.
 <FilesMatch "^(xmlrpc\.php|wp-trackback\.php)">
 Order Deny,Allow
 Deny from all
 #Allow from x.x.x.
 </FilesMatch>

This code also eliminates hackers trying to gain access to your website via the xmlrpc.php file and that’s a good thing to turn off.

17. Disable Other Websites Linking to Your Images

This is yet another bandwidth hog item. You want to make sure you’re not letting other websites out there use your images for free. They’re stealing your bandwidth (and images). Add this code to your .htaccess file:

# This is so nobody links to image files on my website
 RewriteCond %{HTTP_REFERER} !^$
 RewriteCond %{HTTP_REFERER} !^http://(www\.)?tonyherman.com/.*$ [NC]
 RewriteRule \.(gif|jpg|swf|flv|png)$ /feed/ [R=302,L]

In that code, you’ll need to obviously replace “tonyherman.com” with your domain name. Leave the question mark there and everything else as this code is using something called “regular expressions” that mean something.

18. Specify a Character Set

Since GTmetrix explains this the best, here is how they say it:

What is a character set definition?

A character set is essentially a set of characters represented by numbers for a computer. For example in the ASCII character set the numbers 0-127 are used to represent all English characters as well as special control characters.

Why is it important?

It’s important to specify a character set in the HTTP response headers of your HTML documents to allow the browser to begin parsing HTML and executing scripts immediately.

Without specifying a character set the browser is left to figure it out on its own which takes time and therefore negatively impacts your page load times.

To set it, you’ll once again just add something to your .htaccess file so that it affects all the pages on your website. Add this:

# Use UTF-8 encoding for anything served text/plain or text/html
 AddDefaultCharset UTF-8
# Force UTF-8 for a number of file formats
 <IfModule mod_mime.c>
 AddCharset UTF-8 .atom .css .js .json .rss .vtt .xml
 </IfModule>

When you specify a character set, the web browser doesn’t have to spend time trying to determine a character set to make the page look good.

19. Make Sure All Images Have Dimensions Set

We’re continuing to get into the nitty gritty of your website here but every little bit helps. You want to make sure you have dimensions (width and height) set on every image you’re using. This way, the browser doesn’t have to take time trying to render the layout of the page while images load.

Basically, go look at the code of pages and look for images. They should look something like this:

<img src="image-name.jpg" width="300" height="250" alt="An Image">

You can see the width and height specified there. If it instead looks like this:

<img src="image-name.jpg" alt="An Image">

Then it needs to be fixed.


Conclusion

Take the time to work on these things and it’ll really pay off. If you think about it, you spend an hour or two working on this now and these changes keep working for you going into the future, 24/7/365. The bottom line is, it’s worth doing.

If you follow the steps listed here you will increase website loading speed to where your website will run a lot faster and you should get better rankings. When you increase page speed and load time, Google, Bing, Yahoo and other search engines will favor your website over your competitors. Anyone that wants to improve website speed should follow the steps here.

When you do what I list here and increase page load speed, please leave some comments below and let me know how your website did – I would really like to know. Hopefully you will see better web page load times after going through the steps here.

If you have other ways to increase site speed that I didn’t cover, please comment below and explain them so that everyone can benefit.

Need More Help?

At the end of the day, it really does take an expert to work on your website loading times and Google PageSpeed scores. If it were easy, then everyone would do it but that’s just not the case.

If you want help working on the speed of your website, then contact my company, Webstix, and we can do all this work for you. In fact, we’ll guarantee that we can get most any WordPress website passing scores with Google PageSpeed – yeah, my team is that good. Really.


FREE Book - 395 Power Words

Leave a Reply