What is Content Delivery Network or CDN
Essentially, a CDN or Content Delivery Network, takes all of the website static files such as CSS, Javascript, images and etc., and distribute them to their edge cache servers all over the world. This change lets visitors download them as fast as possible by serving the files from servers as close as possible to their actual geographical location. Another big advantage of a good CDN service is the additional layer of security and cache which also lead to reduced bandwidth consumption.
We personally prefer to use the Cloudflare Content Delivery Network when it comes to optimizing WordPress websites. We have found that they have the most reasonable price/feature ratio and their dashboard is simple and easy to use. Also they have free plan which makes them suitable even for starting businesses. They also have many guides and well developed community.
In our fifth day of the WordPress Week of Speed at WPCacheOn, we will show you how to fine tune your website at Cloudflare for maximum speed. First you will need to create an account with Cloudflare and then route your domain name through their DNS zone. They have very detailed guide on how to create an account with them which can be seen on the next link:
Cloudflare Page Rules
Once this setup is completed you will be able to see all of the Cloudflare features. First we will access the “Page Rules” page where we will add three Page Rules, which comes with the free plan:
Page Rule 1: Optimizing and protecting WordPress admin dashboard – The admin dashboard should be not cached as this could lead to degraded performance in the section in question. We will also set the security options as we want to secure the dashboard. The * (asterisk) symbol will make the rule to apply for all URLs with the wp-admin part. You can see the actual settings in the next screenshot:
NOTE: Instead wpcacheon.io you should set your actual domain name. Additionally if you are using Railgun, you should disable the same for the wp-admin:
Page Rule 2: Preventing Cloudflare from frequently refreshing the cache on stale pages –Items in your WordPress website such as the images in the wp-content/uploads folder do not change often, this is why you will not have to refresh their cache often. This will save bandwidth and Cloudflare will not have to go back and forth to your server for fresh copy of the cache. The settings for the second page rule can be seen next:
We recommend you to explore your website and consider which sections are not updated frequently. Then you can create similar page rules for them as well.
Page Rule 3: Aggressive cache for everything – last but not least we will configure Cloudflare to aggressively cache everything else on the website:
As noted above, make sure that when you set the Page Rules in your Cloudflare account to set your domain name instead wpcacheon.io.
Cloudflare Speed Optimization section
In the next part of this guide, we will configure the Cloudflare Speed settings and more specifically the “Optimization” section:
Once you navigate to the mentioned menu, ensure the following options are enabled:
And also ensure that the following option is disabled:
Now a bit more information about these options:
- Auto Minify – WPCacheOn already minify the HTML, CSS and JS files of your website. In most cases enabling this option at Cloudflare will speed up your website even more.
- Brotli – This is similar to gzip but improved. Once again WPCacheOn assist with gzip-ing your website content, enabling this option will provide yet another compression on CDN level. As you can guess this will also lead to speeding up to your website.
- Rocket Loader – This option defers the loading of the JavaScript files. This will improve not only the website loading speed but the user experience as well.
- AMP Real URL – This option should be disabled. If you are using AMP this option will allow pages to be stored in an AMP cache and served quicker while showing the original site URL in the browser.
With all these changes according to the Cloudflare statistics your website will become around 50% faster. Faster loading website have improved SEO and make the users stay on the site. This will lead to more profit for your business.
Final words
In closure on our fifth day of WordPress Week of Speed at WPCacheOn we have showed you how to optimize the performance of our website through CDN service once again only with a few clicks. Do you already use a CDN service? What CDN are you using and why? Are you going to use CDN service after reviewing this guide? Once again we would love to hear your comments on these questions.
Tomorrow will be the sixth day of the WordPress Week of Speed at WPCacheOn where we will share with you a few final performance improving secrets for your WordPress website. This will be also our closing day of the WordPress Week of Speed at WPCacheOn.
In the meantime, check the other optimization guides about choosing a good web hosting service for WordPress, how to optimize the WordPress database for better performance, which plugin to use for WordPress optimization and how storing old revisions, enabling pingbacks & trackbacks could have a negative impact on your website speed.