So in the past, I realized that some of projects gained traction and new projects had a requirement to off-load static content using a Content Delivery Network.
So you should be using base_url already in your application to link to your assets or content. If you are not, you are not making your website environment independent. I assume you are already using the function, you should change your assets and content to use this function if this isn’t the case.
Lets extend the current URL helper function. Edit the file application/config/config.php.
Lets overwrite the existing base_url function. Create a new file application/helpers/extend.url_helper.php.
Now lets set the CDN URL. Edit applicaiton/config/config.php. Add these new lines.
So once you create your cdn_url, your base_url function will operate normally and use cdn_url instead of base_url if applicable. So all your pages will be referencing into the CDN. That was easy.