Editor’s note: This blog was originally published in 2013. It has been updated for accuracy and to reflect modern practices.
If you’re looking for a better user experience on your website — including faster page and resource load time — a content delivery network (CDN) is the way to go.
By investing in a CDN, you can save your online business a ton of money and minimize damage from potential DoS attacks.
However, this system is not always embraced with open arms by SEO teams.
Understandably, many SEOs get concerned to find out that the website they’re overseeing will start hosting its images and other content on another domain. But, with a little preparation, CDNs and SEOs can exist harmoniously.
Today, we’ll share four SEO CDN best practices that will allow you to get the benefit of the latter — without the risks to your site’s organic performance.
First: Does a CDN Affect SEO?
How much your content delivery network influences your search engine optimization strategy depends on how well you understand the relationship between the two — and whether you have the right precautions in place.
Google’s official stance is that a CDN does not directly benefit SEO performance. However, from an advantages standpoint, a CDN has the undeniable upper hand in speeding up your site performance.
Caching your web page information minimizes future load lag time, improves your page loading speed, and enhances your site’s user experience. (It’s also why we recommend using a CDN to improve your Core Web Vitals.)
But with this caching ability comes some potential for mistakes. If not set up properly, you could run the risk of duplicate content, incorrectly indexed content, and more.
But, with an informed SEO and web dev team looking out for you, a CDN often ends up being a boon to your SEO strategy, not a drag.
4 Best Practices for CDN SEO
Below, we’ve listed a few of the strategies our team employs when working with CDNs on our eCommerce clients’ sites. Use them as a basic checklist to get started, and make sure to rope in your web development team for a more comprehensive understanding of your current site’s standing.
1. Use Your Own Subdomain.
For more control over your site’s performance, we recommend setting up your canonical name record (CNAME), so that your CDN exists on a subdomain of your site — i.e., cdn.yoursite.com. Avoid hosting with the CDN (yoursite.CDNCompany.com) if possible.
In other words, ask your CDN provider if you can have the service exist on your own subdomain instead of one of theirs.
Note that some CDN services, like CloudFlare, act more like a reverse proxy for your entire domain — which means nothing really changes in your URLs anyway. (In fact, if you’re using WordPress as your web hosting platform, you may not even need a CDN at all, as both WordPress Engine and Kinsta have completely removed the ability to connect to this kind of network.)
2. Retain File Names and Paths.
Remember to keep the same file-naming conventions you had before the CDN to avoid unnecessary redirections and to keep your website content properly indexed.
For example, let’s say an image lived at your original site at www.yoursite.com/images/image1.jpg. The CDN you chose might rename that file (assets.yourdomain.com/images/000123.jpg) or change the folder structure (assets.yourdomain.com/assets/image1.jpg).
Without the proper redirects, your image could be lost to your website visitors and/or Google’s crawler, reducing your image search traffic numbers and breaking any existing backlinks.
3. Set Up the CDN in Webmaster Tools.
By setting up and verifying your CDN subdomain in Google Webmaster Tools and Bing Webmaster Tools, you accomplish a few key things:
- Set your site’s geographic target. This is crucial if the IP address of your CDN is outside of your targeted country. Otherwise, search engines could mistakenly target a different geographical location than your intended audience.
- Use the URL removal tool. Where necessary, this tool allows you to remove or block certain URLs from indexation, which can free up your valuable crawl budget.
4. Use Rel Canonical on CDN-Hosted Pages.
The solution: Use the rel canonical tag.
To avoid even more complications, we recommend implementing that as an absolute (as opposed to “relative”) path. Depending on your site setup, you may need to loop in your web developers to identify any complete pages hosted on the CDN, invalidate them, and then request their removal from Google’s index.
Here’s an old (but still relevant!) example from our friends at Moz (shared in an email to our team from then-director of inbound engineering Casey Henry):
We found out the hard way when Amazon introduced CDN for pages that we were having a duplicate content issue. We took the following steps to stop it from happening:
Every page view for Moz.com is running through our CMS, so we look for the Cloudfront User Agent and throw a 404. Because Amazon won’t cache a 404, there are no duplicate pages within Cloudfront — only our images. The images don’t go through the CMS, so they don’t get blocked and work fine through the CDN.
Once we put this in place, we had to invalidate every page that was cached and then request they be removed from Google.
Again, we recommend speaking with your web developer or tech SEO team to identify and resolve any site issues like this.
Creating an SEO-Friendly CDN Strategy
While hosting on a content delivery network does come with potential SEO challenges, in our opinion, the page speed improvements gained by doing so outweigh these risks. As long as you can identify these potential errors (and put tactics in place to prevent them), your SEO and CDN need not work against each other.
Follow these best practices, and your site should be fine.
To learn more about CDNs and their effects on SEO performance, we recommend the following resources:
How do I know if I am hosting complete web pages on a cdn?
Great post, Everett!
I work for a CDN (CDNetworks) and we are often presented with the concerns that you have listed. As you have indicated, most of these are not real concerns, as most CDNs do provide various configurations to resolve common routing and CName issues.