How to Set Up CDN the Right Way and Avoid SEO Problems
Tired of your website loading like a snail? Well, installing a CDN system on your WordPress blog can help, but setting it up wrong can really hurt. I’ll show you why and how to avoid those problems.
CDN stands for “Content Delivery Network”, and it’s a way to cache content on your website that doesn’t change very often across several servers located all across the Internet. This might include scripts and images that make up parts of your web pages that never change. So now, whenever someone in California, for example, accesses your website in their browser, the content is delivered to them from one of the CDN’s local servers and using cached content.
This helps in multiple ways. Not only do pages load extremely fast for your readers, but it also reduces the overall load on your own web server, because you aren’t constantly serving up the same exact content all the time. It also helps with SEO for your site, because page load time is in fact one factor in the Google ranking algorithm. It’s a great thing to do, but not many newer website owners and blogger use it, because setting it up isn’t entirely straightforward. It can even hurt your SEO if you don’t do it right!
Signing Up for a CDN
In the early part of 2014, following James’ lead , I posted a set of instructions for setting up W3 Total Cache including CDN settings. In that article I mentioned that you can stick with the default CDN URL that ends in “netdna-cdn.com”, but that you have to make sure to enable SEO settings in your account so that those web pages are “nofollowed”. Otherwise they could get identified by Google as duplicates and ultimately damage your overall ranking – especially for images. In this article, I’m going to walk you through the advanced approach so that the CDN URL actually matches your own website’s domain. This can significantly help with keeping any content that may get crawled by Google under the same domain – preventing you from losing all of that SEO juice from your image content.
First things first. You need to sign up for a new CDN account if you haven’t already (in my case I use MaxCDN, because they offer an ultra-cheap account for small website owners with bandwidth under 100GB a month).
Not to promote MaxCDN or anything (I’m sure other CDN’s are just as good), but I thought it was pretty cool how just as you’re browsing the site, a help desk person proactively asks you if you need help. They helped me figure out how to re-enable my old account and get my settings all configured the same day.
Once you sign up for an account (if you haven’t already), you’ve got to create your first “Pull Zone”. Give it a suitable unique name, identify your original website URL, and give it a label.
Now for the important part. Go into “Settings” and create a “Custom Domain” that includes your actual website domain. Typical is something like “cdn.yourdomain.com”. Click on the “+Add” button and your custom domain will be ready to go.
It isn’t live yet though. This setup won’t work until you add the CNAME with the correct “.netdna-cdn.com” URL.
Setting Up CDN on Your Server
You can do this inside of Cpanel by clicking on the “Simple DNS Zone Editor” icon under the “Domains” section.
This is the part that makes it all work – so do it right. The Name field needs to be the custom CDN url that you set up in your CDN account. The CNAME field needs to be the CDN’s URL listed on the Pull Zone settings page. It’s the one that ends in some other domain URL that’s not your own site’s domain.
Okay, so now you’ve got your CDN account properly set up and you’ve got your own web server set up to interpret the custom domain. All you’ve got left is to correctly configure CDN in your WordPress Admin panel.
Setting up CDN in WordPress
As I mentioned in my last article on the plugin, I prefer W3 Total Cache to handle site caching. Other caching plugins will have a section on CDN as well. For W3 Total Cache, you’ll need to go to the General Settings tab first so you can enable CDN if you haven’t already.
Don’t forget to select the correct CDN that you have an account with (in my case it’s MaxCDN), and then “Save all settings”.
Now go down to the CDN link in the plugin navigation bar, and make sure to select “Add canonical header”. This makes sure that each of the CDN served pages also include a canonical meta tag that tells the crawler the original image is actually located on your website, not the CDN’s web server. This is just one more important element that protects you from the SEO damage a CDN can potentially inflict on your site.
Finally, under “Configuration”, you’ll want to click on the “Authorize” button. This will connect to your chosen CDN network webpage, and you may need to log in. Once you do, you’ll receive a long authorization code that you’ll need to copy and then paste into the “Authorization key” field.
Past that key into the field, and then in the “Replace site’s hostname with:” field, type in the custom CDN url that you went through all of that effort of creating. This is the beautiful part – and you’ll see why in a minute.
Click “Add CNAME”, and then “Test MaxCDN” just below these settings.
If you did everything above correctly, you should see the “Test passed” status show up.
Click on “Save all settings”, and now you have properly configured CDN account for your site that won’t steal all of your hard-earned SEO juice. Google will still see all of those images as coming from your domain.
Here’s an example of the source code of one of the pages on my site. As you can see, the URL is still “topsecretwriters.com”.
The last thing you want to do is destroy your strong search engine standings in exchange for server performance. By correctly setting up CDN though, you really can have the best of both worlds. Beware of sites that recommend just using the default CDN URL. While canonical and the SEO settings in your CDN account may protect you from SEO damage, there’s no guarantee. Nothing is as disheartening as seeing images show up in Google Image search as coming under the CDN URL rather than from your own domain.
In 2012, Matt Cutts reiterated the SEO evaluation of subdomains by Google as being equivalent to subdirectories on your site. They are treated no differently.
That means that if the URL ends in “netdna-cdn.com”, that image will not be considered as even related to your site in an way. The fact that it’s now viewed by Google as a part of your domain means that you still maintain search value from those images in Google Image search, and the “link juice” from your page to your images remain on your own domain.
The beauty of having a properly configured CDN setup is that you now have everything you had before – everything under your own domain – but you also get the tremendous bonus of a crazy-fast loading website. This not only makes Google happy, but it makes your visitors very happy.
Give it a try and see if setting up a CDN for your website makes a performance improvement. Let us know what your experiences were while you were going through this process. Was it easy? Did you run into problems? Share in the comments section below!
Image Credits: Torkild Retvedt Via Flickr