Does Speed Matter?

Have you ever bailed from a website because you got tired of waiting?

According to a case study conducted by StrangeLoop, a 1 second delay in page load time can lead to a 7% loss in conversions, 11% fewer page views, and a 16% decrease in customer satisfaction. If your website earns $1,000 per day, you could wind up with a lot of unhappy visitors and a loss of over $25,000 per year.

Major search engines like Google and Bing also penalize slow loading websites by pushing them down in their results pages. Slower websites will receive less traffic. Less traffic means less revenue.

How Fast is Your Current Website

Since we won’t know how far you’ve come if we don’t know where you started, head on over to Pingdom and run a quick speed test on your website. Be sure to select the “test from” location closest to you.

If your load time was less than 2 seconds then you’re already off to a good start. If not, we’ve got some work to do. Either way, let’s get started!

Here We Go

1. Choose a Good Host

Your web host is the foundation on which your entire website is built upon. If you’ve got poor web hosting, it doesn’t matter how nice your website is.

As a general rule, we recommend steering clear of these companies. Some of these companies are major players in the hosting industry, and you’ll be tempted to hop on their bandwagon because they’re cheap. But don’t do it. Please.

They get away with charging so little because they overload their servers and cram as many accounts onto them as possible. This leads to guaranteed poor performance. Since we’ve already determined the need for speed, this is an obvious issue.

They’ve also been known to run outdated software which is a notable security risk. Cheap and good don’t come together. Don’t do it. Just don’t.

As for recommendations, we’ve found A2 Hosting to be one of the best hosts in the industry. There are certainly other hosts out that worthy of your business, but A2 is our preference.

2. Use an Effective Caching Plugin

Caching plugins are some of the most useful plugins in existence. We won’t bore you with the technical details on how they work, just know caching alone can make your WordPress site 2 to 5 times faster.

There are multiple caching plugins that will do the job, but we prefer and use WP Fastest Cache. It’s free, easy to setup, and will immediately result in faster page loads.

3. Optimize Images

A website needs images in order to come to life and be inviting to visitors. But unoptimized images can bring your website to a crawl. Images should be resized as close to the size they’ll be displayed, using an image editor such as Photoshop or GIMP. Uploading a 1920×1080 image and then resizing it 480×270 on your website results in a much larger file size than is necessary.

It’s also essential that you compress your images using an image compression tool such TingPNG (despite the name, TinyPNG will compress both JPG and PNG images). Some of our image file sizes have been reduced by as much as 80%! We’ve found the easiest way to ensure all of your images are compressed is to use TingPNG’s WordPress plugin. This plugin will compress all of the images, not just the original that you uploaded.

While it’s true the image quality will be slightly reduced due to compression, rarely is it enough to notice a difference. But if you’ve got superhuman eyesight and happen to notice a difference, the benefits (reduced file size, faster loading time, and decreased bandwidth usage) vastly outweight any slight degredation.

4. Optimize Your WordPress Database

Over time your WordPress database will store quite a bit of information that you probably don’t need. This includes things such as page and post revisions, trashed posts and pages, transients, and spam comments.

You can easily and quickly manage this unwanted waste by using the WP-Optimize plugin. WP-Optimize will allow you to safely remove all of this, as well as optimize the database structure.

Limiting the number of post revisions is another great way to make sure your database doesn’t become clogged with a bunch of trash. You can limit the number of post revision by opening your wp-config.php file and adding the follow code before the line that says /* That's all, stop editing! Happy blogging. */. Simply replace the number 3 with however many revisions you want to save.

define('WP_POST_REVISIONS', 3);

The remaining optimizations require some manual editing of your website’s .htaccess configuration file. If you are not familiar, or comfortable, with editing server files, please do not attempt to do so. Incorrectly editing the file(s) will result in your website crashing. If you would like assistance with these changes please contact us for a work request, and we will be happy to make the changes for you.

Always backup your website and any files you will be editing prior to making any changes.

5. Enable Gzip Compression

Gzip compression should be one of the top priorities when it comes to your website speed optimization. It is also one of the easiest optimizations to enable for your WordPress site.

What is Gzip?

In simple terms, Gzip reduces the size of your website files before sending them to your visitor’s browser. Just how much is the size reduced? Our homepage was reduced from 28,793 bytes to 7,140 bytes. That’s a reduction of over 75%!

A smaller file is obviously going to transfer faster than a larger file. This smaller size means faster page loads and reduced bandwidth.

Enabling Gzip

There are different ways to enable Gzip compression for your WordPress site. Gzip can be enabled from within cPanel, but since each web host has their cPanel setup slightly differently the method of doing so will vary from host to host. The most universal way to enable Gzip is by simply adding this code to your .htaccess file:

<IfModule mod_deflate.c>
#Compress HTML, CSS, JavaScript, Text, XML and Fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf
AddOutputFilterByType DEFLATE application/x-font-truetype
AddOutputFilterByType DEFLATE application/x-font-ttf
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE font/opentype
AddOutputFilterByType DEFLATE font/otf
AddOutputFilterByType DEFLATE font/ttf
AddOutputFilterByType DEFLATE image/svg+xml
AddOutputFilterByType DEFLATE image/x-icon
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/xml

#Remove browser bugs (only needed for really old browsers)
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
</IfModule>

Verify Gzip is Enabled

Alright, now that we’ve got the Gzip code added, it’s time to verify that Gzip is actually enabled. By using this Gzip checking tool you can verify Gzip is working and you can also see how much your file sizes were reduced. If Gzip is still not enabled, your web host probably has not enabled it on your server. We recommend contacting them and asking them to enable it. If they won’t, we recommend moving to a new host. Every reputable web host should have something as basic as Gzip enabled for all of their accounts.

6. Use .htaccess For Domain Redirects

Visitors to your website will be directed to the exact address you set in the WordPress General Settings (i.e. with or without the www). For example, if you set your WordPress Address as www.yourdomain.com and someone types yourdomain.com (without the www) into their browser, WordPress will redirect them from yourdomain.com to www.yourdomain.com.

WordPress uses php to initiate this redirect, which results in a noticeable delay. Since we are trying to make our website as fast as possible, we can save time by using the .htaccess configuration file to do the redirect, instead of waiting for WordPress to do it.

Redirect to www

If you are using www.yourdomain.com as your preferred address, and ARE NOT using SSL, add the following to your .htaccess file:

#Force www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yourdomain\.com [NC]
RewriteRule ^(.*)$ http://www\.yourdomain\.com/$1 [R=301,L]

If you are using www.yourdomain.com as your preferred address, and ARE using SSL, add the following to your .htaccess file:

#Force www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^yourdomain\.com [NC]
RewriteRule ^(.*)$ https://www\.yourdomain\.com/$1 [R=301,L]

#Force https:
RewriteCond %{HTTPS} !on [NC]
RewriteRule ^(.*)$ https://www\.yourdomain\.com/$1 [R=301,L]

Redirect to non-www

If you are using yourdomain.com (without the www) as your preferred address, and ARE NOT using SSL, add the following to your .htaccess file:

#Force non-www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com [NC]
RewriteRule ^(.*)$ http://yourdomain\.com/$1 [R=301,L]

If you are using yourdomain.com (without the www) as your preferred address, and ARE using SSL, add the following to your .htaccess file:

#Force non-www:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.yourdomain\.com [NC]
RewriteRule ^(.*)$ https://yourdomain\.com/$1 [R=301,L]

#Force https:
RewriteCond %{HTTPS} !on [NC]
RewriteRule ^(.*)$ https://yourdomain\.com/$1 [R=301,L]

Be sure to update the code with your actual domain. Save the file and overwrite the original.

We saved nearly an entire second when we switched from using php (WordPress) to .htaccess for our redirect.