How to setup CDN in WordPress without Caching plugin

We all are aware of the benefits with the faster website, and how adding a CDN service literally adds wings to your existing WordPress site. A Content Delivery Network, reduces your website load time, many folds, additionally it also reduces the load on your server, by serving the static content from the nearby POP locations. Everything seems good, but, the real problem arises with the integration of a CDN service into your WordPress site. The issue is that a majority of the CDN service providers doesn’t offers their native WordPress plugins to integrate their services with your WordPress sites, which leads you to use a third-party plugins, such as W3 Total Cache and WP Super Cache, to do the same.

Till now, I had always used a cache plugin (W3 Total cache preferred), on nearly each and every WordPress site I had created so far and everything was running good until the managed WordPress hosting came to light. The managed WordPress hosting service is amazing, they take care of all the back-end tasks to manage your WordPress site’s performance, speed and everything in between. However, they won’t allow you to install a caching plugin on your site due to the fact that they already uses some highly effective custom caching environment including Varnish and Memcache to speed up your site. This custom caching environment doesn’t plays well with the caching plugins out there and are blocked or simply got removed from your WordPress sites.

Okay fair but, what if –

  • You need to integrate CDN on your site hosted on these managed WordPress environment?
    • For eg. Godaddy, Media Temple, etc.
  • You don’t want to use the default CDN services, provided by these managed hosting providers and prefer to use some other CDN services of your choice?
    • For eg. WPengine, Websynthesis, Flywheel etc.
  • Your site is hosted on a shared hosting environment that offers an extra layer of advance caching system and they also blocks these caching plugin, but still you want to use a CDN to further boost site speed?
    • For eg : Siteground, they uses SuperCacher functionality (a mix of Varnish and Memcache) that automatically blocks W3TC and WP Super cache.

Well, there’s a single solution to all such issues, CDN Linker.

 What is CDN Linker?

CDN Linker is a simple WordPress plugin, created by Mark Kubacki, it integrates any CDN service to your WordPress site. You can specify which WordPress directories you want to be served by the CDN of your choice, such as ‘wp-content’ and ‘wp-includes’ and it replaces your blog_url with the URL of your CDN. This results into serving your static content from the given directory via CDN.

Be sure this plugin only utilizes those CDNs which supports “Origin Pull,” or else if you’re going to manually upload the files to CDN.  Instead, this plugin won’t work with your CDN provider, sorry!

How do I know my CDN supports, “Origin Pull.’ ?

Alright, here’s the list of some popular CDN that supports “Origin Pull,” and plays well with CDN Linker.

CDNs that supports – Origin Pull

  • Akamai
  • Amazon Cloudfront
  • BitGravity (Tata Communications)
  • Cachefly
  • CDN77
  • CDNetworks
  • CDNify
  • ChinaCache
  • ChinaNetCenter
  • EdgeCast
  • Fastly
  • Highwinds
  • Incapsula
  • Internap
  • KeyCDN
  • Leaseweb
  • Level3
  • Limelight
  • MaxCDN
  • NetDNA
  • Telefónica
  • XCDN

Okay, my CDN supports “Origin Pull,” now what?

Just go the official plugin page at GitHub and download the plugin. The plugin is free for personal use, however if you want to use it on your commercial site, then you need to ask the plugin developer for a license.

Once you’ve downloaded the plugin, now upload it to your WordPress installation and activate the plugin.

Navigate to WP Dashboard> Settings > CDN Linker

WordPress CDN linker settings

CDN URL : Fill out your CDN URL in this field.
For egAmazon CloudFront, it’s like “xxxxxxxxxxxxxxx.cloudfront.net.”
MaxCDN, it’s like “xxx.xxxxxxxxxxxx.netdna-cdn.com”

Rest leave the other settings as default, or change them if you know what you’re doing and press the ‘Save changes” button. That’s it, now go ahead and flush the cache on your WordPress site to reflect the changes done by the plugin.

How to test the CDN is perfectly integrated on my WordPress site?

On the plugin settings page, you can use the integrated image testing method.  Just click on the link to the default WordPress RSS image file. If the CDN is properly configured, you can see the image file or else the link won’t display any image.

Alternatively, If you’re using Mozilla Firefox or Google Chrome, just right-click on the front-end of your site, and view page source. You could see your image files, CSS and JavaScript are now loaded from your CDN. Something like this.

images loaded from CDN

Known issues

Initially, the CDN Linker plugin works well out of the box, without any issues. However, if you’re using Disqus comment system on your WordPress site, then you should “uncheck” rewrite root-relative refs or add count.js and embed.js to exclude if substring, located in the CDN Linker plugin settings.

Conclusion

The CDN Linker solved a big problem for me, recently when I transferred Blogosense.com from Hostgator India to Siteground shared hosting plans. The transfer was swift and everything was working super smooth, and their SuperCacher feature is what I like the most but, it’s not compatible with any caching plugin like W3 Total cache. I actually don’t want the W3TC plugin, instead I just need it to configure my Amazon CloudFront CDN on this site. Later I found this CDN Linker plugin, and it worked like charm. I hope you found this short guide useful, feel free to let me know your thoughts and any issues related to this guide, in the comments below.

1 thought on “How to setup CDN in WordPress without Caching plugin”

  1. Thanks for Sharing the Plugin installation tips.

    I was actually wondering if I should check or uncheck the rewrite root-relative refs. The plugin itself does not explain it very well and MaxCDN explanation page also fails to explain the whats behind the rewrite root-relative refs.

    Thanks

    Dan

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top
Scroll to Top