Before you take any steps please back up your files and database.
This tutorial helps you to integrate CDN into your CakePHP CDN installation. You could use either a Pull or Push Zone but in most cases is a Pull Zone sufficient. The following example will work for CakePHP version 2.4 or higher. For more details about the global configuration variables visit http://book.cakephp.org/3.0/en/development/configuration.html
1. Create a pull zone before you start the CakePHP CDN integration.
2. Define the base URL variables in your ./Config/bootstrap.php config file.
... Configure::write('App.imageBaseUrl', 'http://cdn.example.com/img/'); Configure::write('App.cssBaseUrl', 'http://cdn.example.com/css/');
Configure::write('App.jsBaseUrl', 'http://cdn.example.com/js/');
...
Type in your CDN Domain ot the CNAME that you specified in the SkyparkCDN control panel. Ensure that your CNAME record has been configured in a proper way befor using it for integration.
3. Use the HTML helper to include your assets in your views or template.
HtmlHelper::css
<?php echo $this->Html->css('your-css'); ?>
Will output:
%lt;link rel="stylesheet" type="text/css" href="http://cdn.example.com/css/your-css.css" />
HtmlHelper::image
<?php echo $this->Html->image('your-logo.png', array('alt' => 'Your Logo')); ?>
Will output:
<img src="http://cdn.example.com/img/your-logo.png" alt="Your Logo" />
HtmlHelper::script
<?php echo $this->Html->script('your-js'); ?>
Will output:
<script type="text/javascript" href="http://cdn.example.com/js/your-js.js"></script>
Integration has been completed! We highly recommend you to check the HTML code of your webpage to ensure that URLs have been rewritten properly from your original ones to CNAME from the control panel.
To do that press F12 or open Developers Tools in your browser, choose the Network tab and refresh the page. All static files should have your CNAME in URLs.