WordPress use CDN with out plugin

Content Devlivery Network (CDN) allow your web site to serve images from another domain or a sub domain. This speed up web site as your web server don’t need to serve images. Also browsers have a limit on number of parallel downloads from same domain. Having images on a differnt domain bypass this limitation of web browser.

If you use a pull type CDN or a CDN that you manually upload using some sync tool, you need to rewrite all image url to CDN url. There are several plugins available to do this. But you can easily do this with out any plugins.

Edit file

Add following code to end of the file.

This will replace image urls with CDN url.

Leave a Reply

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