We all know that one of the most important aspects of your website is it’s speed – it has been proven that even a small delay in loading time will cost you visitors, for example if run an eCommerce website making $100,000 per day, a 1 second page delay could potentially cost you $2.5 million in lost sales every year. It also known now that speed of a page is taken into account in Google’s ranking algorithm which could mean the difference between you and a competitor holding the top spot for a search term.

Luckily, speed up your website can be done with a few small tweaks which should be in reach of most people’s technical abilities. After picking fast web hosting, which is probably the number one way to improve your site speed there are a number of other things you can do, one such thing is by employing the use of a Content Delivery Network ( CDN ).


WPEngine Promo Discount Code Exclusive WPEngine Coupon Code for AlienWP Visitors!
Get 5 Months Free & 30% Off All Plans.
Click the coupon code to copy and open the link »
alienwp30
Click To Open/Copy

If you want to speed up your WordPress site while reducing the load on your own web server, a content delivery network, or CDN for short, is one of the best ways to do that. In this guide, we’ll tell you everything you need to know about content delivery networks, including how to add a CDN to WordPress for free with a service called Cloudflare.

If you’re interested in making a massive improvement to your WordPress site’s page load times, keep on reading!

How Does a Content Delivery Network Work?

Usually, whenever someone visits your website, they have to download all of your website’s files (HTML, images, text, etc.) from your web server.

You might not know it – but your website is usually stored on a specific server in a physical data center located in some city around the world.

For example, if you host your site in Dallas, Texas, that means everyone who visits your site has to download your site’s files from Dallas, Texas.

Now, that’s fine if your visitor is located in nearby Austin, Texas.

But what if your visitor is in London? Sure, the Internet moves incredibly fast, but it’s still limited by the laws of physics. That is, it’s going to take your site a tiny bit longer to load for the London visitor than for the Austin visitor.

So how does a content delivery network tie in?

A content delivery network stores copies of your site’s files on different servers all around the world. That way, visitors from anywhere in the world can download your site from the nearest content delivery node, instead of needing to get it from your actual server.

What Are The Benefits of a CDN?

Ok, so that’s the major benefit of a CDN:

Speed.

Because your visitors can download your site from the nearest content delivery server, it just plain takes your site less time to load.

Beyond page load time improvements, though, content delivery networks also offer a few other benefits:

  • Less work for your server. Because content delivery network nodes serve your content, your actual server has to do less work.
  • Security. Many CDNs provide protection against attacks such as DDoS attacks.

Next up, we’ll get into actually showing you how to add a CDN to WordPress using Cloudflare.

Cloudflare: What We’ll Be Using For This Guide

For this guide, we’re going to use a free CDN service called Cloudflare.

We like Cloudflare because, in addition to being free, it:

  • Is one of the easiest CDNs to set up for WordPress
  • Offers a web application firewall, DDoS protection, and client side SSL (this isn’t the best SSL, but it’s better than nothing)

Here’s how to add a CDN to WordPress using the free Cloudflare plan.

How to Add a CDN to WordPress With Cloudflare

We’ll cover each step in detail, but here’s a high-level look at what you need to do to get set up with Cloudflare and WordPress.

  • Create a free Cloudflare account
  • Add your website to Cloudflare
  • Change your domain nameservers to point to the Cloudflare nameservers
  • Install and activate the official Cloudflare plugin to finish configuration

Nothing too complicated! Even if you don’t know any code, you’ll be able to follow this guide.

Step 1: Sign Up for Cloudflare

To get started, head to Cloudflare, enter your details, and click the Sign Up button:

Step 2: Add Your Website to Cloudflare

Once you create a Cloudflare account, you should see a Get Started With Cloudflare interface.

In the first step, all you need to do is enter your domain name and click Scan DNS Records:

Once you click the button, Cloudflare will show you a short video while it scans your website’s DNS servers.

You can watch the video for a basic understanding of how Cloudflare works. Then, once the process finishes, click Continue to move on to the next step:

Step 3: Verify Your DNS Records

Ok, this step might look super confusing if you don’t know what’s going on. Don’t panic – it’s really not complicated.

If you know about DNS, you can make some changes here to tweak how Cloudflare works.

But if you have no idea what’s happening, I’m going to show you a neat little trick.

All you need to do is verify that the icon next to your actual domain name is Orange instead of Grey:

Don’t worry about the other stuff if you’re confused. Just verify that you see that orange icon next to your primary domain and click Continue at the bottom.

Step 4: Select a Cloudflare Plan

At this point, Cloudflare is going to try to upsell you on one of its paid plans. Don’t worry, though. You don’t need to pay.

For the vast majority of websites, using the free Cloudflare plan is totally fine.

Just select the Free Website option and click Continue:

Step 5: Change Your Nameservers to Cloudflare

Cloudflare functions by routing all of the traffic to your site through its own nameservers. For that reason, you need to change your domain’s nameservers to point towards Cloudflare in order to use the service.

On this page, Cloudflare gives you the nameservers that you need to use:

how to add a cdn to wordpress with cloudflare

At this point, you need to go to the place where you registered your domain name and change your nameservers from the Current Nameservers values to the Change Nameservers to: values.

Usually, you’ll do this either at your web host or a third-party register like GoDaddy or Namecheap. Here are instructions for popular places where you might have registered your domain:

If you registered your domain name somewhere else, you should be able to find instructions by Googling – [place where you registered domain name] + change nameservers.

Once you change your nameservers, you might need to wait up to 24 hours for the changes to take effect. Your site shouldn’t experience any downtime, though.

Once you’ve made the change, go back to Cloudflare and click Continue.

And that’s it! Your CDN is up and running. There’s just one more optional step that directly syncs Cloudflare with your WordPress site.

Step 6: (Optional) Install and Configure Cloudflare Plugin

The official Cloudflare plugin is an optional add-on that lets you control Cloudflare settings from inside your WordPress dashboard. Beyond bringing the settings panel into WordPress, it also helps to make some configuration changes that help specific Cloudflare features work better.

To set it up, first install and activate the Cloudflare plugin. Then, go to Settings → Cloudflare to configure it.

There, click the button to sign in:

On the sign in page, you’ll need to enter:

  • Email – the same email you used to sign up for Cloudflare
  • API Key – you can find this inside your Cloudflare account by going to My Profile (available by clicking the drop-down in the top right) and looking for the Global API Key option

Then, click Save API Credentials.

And that’s it! Now, you can configure your Cloudflare settings right from your WordPress dashboard.

Other Popular CDN Services for WordPress

While we used Cloudflare for this guide, it’s definitely not the only CDN that works well for WordPress.

Additionally, some people don’t like using Cloudflare because it requires you to point your nameservers to Cloudflare (Cloudflare is a huge company so there’s not a major risk, but it does require you to give up control).

If you’d like some other CDN options for WordPress, these two are both good solutions:

  • StackPath – formerly MaxCDN, StackPath is a popular option with WordPress webmasters.
  • KeyCDN – KeyCDN is a popular, and affordable, content delivery network with a plugin called CDN Enabler that makes it easy to add a CDN to WordPress.

The setup process for both of those CDNs is a tiny bit more complicated, but each has a wealth of documentation that shows you how to complete the setup process.

Wrapping Things Up

CDNs are a great way to improve your site’s page load times, make it more resistant to traffic spikes and DDoS attacks, and take a load off your server.

Cloudflare makes it remarkably simple to add a CDN to WordPress, which is why we chose to use it for our guide.

With that being said, don’t feel like you have to use Cloudflare for your WordPress site. There are other content delivery networks like StackPath and KeyCDN that also offer easy-to-implement solutions for WordPress.

We hope you enjoyed our guide on how to add a CDN to WordPress and please let us know if you have any further questions.

    Leave Your Thoughts

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