How to Easily Speed Up Your WordPress Site

Posted OnNov 19, 2013     CategoryDevelopment, Settings     Comments2 comments

This article will provide a number of practical techniques you can implement to speed up your WordPress Website. You will need Administrator access to WordPress, and SFTP/SSH access to your server, in order to complete all of these tweaks.

You website’s load speed is important. It’s a known factor in customer behavior, such as if they need to wait to long for a page to load, they’re going to close your site and go somewhere else. Even Google pays close attention to your website’s speed, and it is a factor in ranking.

Fortunately, there are almost countless ways to speed up your website, especially when it’s WordPress.

Find Out Why It’s Slow

If you want to fix a problem, you first need to know what it is. To find out what’s slow on your website, and what you can do to improve it, the first step should be to run a test on it. We recommend one of the following tools.

Pingdom will run the test from one of three locations, Amsterdam, Dallas, or New York City, where as PageSpeed runs from where you are, so the numbers Pingdom provides for load speed will vary based on location and the configuration of your website.

Based on the results of the test, you may find yourself implementing none to as many as all of the following tweaks.

GZIP Compression

One of the biggest, and easiest, wins for website speed is Gzip Compression. In simple terms, your webserver, be it Apache or Nginx, compresses the website’s resources before sending them to the browser, and the decompression takes place on the user’s computer. The reason for this is that the speed a computer can decompress is much faster than the internet’s ability to send data.

To implement this on an Apache server, you will need to connect to your server by SFTP/SSH and add the following into your .htaccess file.

#Begin gzip and deflate
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/css application/x-javascript text/plain text/xml image/x-icon

To enable Gzip on an Nginx server, add the following to your configuration file.

server {
        gzip on;
        gzip_types text/html text/css application/x-javascript text/plain text/xml image/x-icon;

Browser Caching

By using Browser Caching, you instruct the visitor’s browser to store your site’s resources on their computer for a defined amount of time. This means that when they load your site for the second time (or greater), they don’t need to retrieve all the images, scripts, CSS, and so on, again. You can also set expire timers on resources you want cached, so fresh and updated content is only retrieved when necessary.

To setup Browser Caching with an Apache server, add the following to your .htaccess file.

<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresByType text/html M3600
    ExpiresByType text/css M3600
    ExpiresByType application/x-javascript M3600
    ExpiresByType image/bmp M3600
    ExpiresByType image/gif M3600
    ExpiresByType image/x-icon M3600
    ExpiresByType image/jpeg M3600

To setup Browser Caching on an Nginx Server, add the following to your server configuration. It will set images, CSS, and JS files to have an expiry timer of 360 days, you can change this according to your needs.

location ~* \.(jpg|png|gif|jpeg|css|js)$ {
        expires 360d;

LazyLoad Images

If your site is very image heavy, a great way to speed up the perceived load time is by lazy loading images. This means that images are only loaded as the user’s browser scrolls to them.

The easiest way to enable lazy loading images on a WordPress site is with a plugin, such as BJ Lazy Load.

Image Optimization

Another way of saving size on your page load, is by optimizing images. There are applications such as ImageOptim for Mac. However, applications like these require that you optimize images prior to uploading them.

If you’d like to avoid this, you can use a plugin, such as EWWW Image Optimizer, which takes care of optimizing images as you upload them.

Post Revisions

When you consider that each post revision is an entry in the database, and you may have tens of post revisions, and who knows how many posts and of what length, you can understand that post revisions can start to take up some serious database space.

As you could imagine, changing the number of revisions kept can help speed your site up, but is generally only for sites with a wealth of content. To implement this, check out our guide on how to change the number of post revisions your WordPress installation keeps.

CSS and JS Minification

The gains from minification will depend on the complexity and build approach of your website, as minification works by removing unneeded whitespace and line breaks from the CSS and JavaScript your site uses.

Much like Lazy Loading, the easiest way to start minifying your resources is through use of a plugin, such as Better WordPress Minify

Theme Choice

Unsurprisingly, the theme you choose for your website can greatly impact its performance — not all themes are made equal. Most often, free themes from questionable sites are the ones that will give you trouble and are coded poorly.

Themes coded to a standard can be found on Themes, Themes, and ThemeForest.

Prevent Hotlinking

Hotlinking is the practice of people using images on their website, but that are hosted on your server. You can prevent this in a few easy steps through adding the following to your .htaccess file.

#disable hotlinking or direct leeching of images
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)? [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)? [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)? [NC]
RewriteRule \.(jpg|jpeg|png|gif)$ – [NC,F,L]



Leave a Reply

Your email address will not be published. Required fields are marked *

Send this to friend