How to enable CDN in WordPress?

Research indicates that if your website takes more than 4 seconds to load when visited by a client, you are at a great risk of losing over 50% in traffic and sales. The surest way of speeding your website and give users a more enthralling experience is using CDN that replies to requests by visitors from the nearest server. To get this enthralling experience, it is important that you enable CDN in your site. This is a complete demonstration on how to enable CDN in WordPress.

Step 1: Buy your preferred CDN service

Today, the market is awash with many CDN providers. You may opt to use EdgeCast, MaxCDN, Amazon CloudFront, or Incapsula among others. Check carefully to ensure the selected CDN supports your pull zone (customer origin). Every CDN comes with a control panel that helps to identify the nearest server and configure the Origin Pull Host.

The control panel also provides the user with an option of setting CDN dns CNAME. This CNAME is important because in identifying your WordPress and will be used in subsequent steps. After activating your CNAME it will indicate resolving on the control panel, calls to files and finally cache them.

Step 2: Update the CDN server

To make configuration simpler, consider using the same server for main domain and original pull. This is crucial because it helps in uploading and mapping files directly to the CDN server. In some cases, depending on CDN selected, the user may be directed to W3TC plugin page pointing an error on configuration and requiring creation of a pull zone. To address this, go back to the WordPress where a new drop list is provided and select pull zone.

Step 3: Configuring Origin Web Pull Server

Enter the origin pull documentRoot and server blog documentroot where files are uploaded and hosted. For static files, you will be prompted to set cache-lifetime headers for the CDN network of choice. Finally, set the tags as part of the WWW protocol. This is a header that is used to establish if content changes at a specific URL and is returned by specific HTTP1.1 yielding server. If a new HTTP responds with similar etags similar to the older response, a visitor can conclude the file or information is the same and, therefore, does not have to download again.

Step 4: Configure Your WordPress up load files and configure the theme

On the WordPress dashboard, check for miscellaneous settings to configure CDN domains and paths. Set the CDN URLs so that all the files will be uploaded to the CDN server directory using origin pull the moment they are pulled and time of cache depending on maximum age rule.

To set the theme, copy all your .JS and .CSS files to CDN directory. Then, edit your website theme (both header and footer .php) so that they point to the CDN location for the stylesheet and .js by checking manage these on the WordPress dashboard.


By enabling CDN in WordPress, you are sure that every client irrespective of location will be able to access your data at lightning speed. Remember that it does not matter what CDN you prefer, when configured correctly, the results will be improved performance for the site.

Say Hello! Don’t be shy.