How to speed up your ExpressionEngine website with GrandCDN

Configuring GrandCDN with your ExpressionEngine website is very easy, and only involves editing 1 line of code on your website.

1. Create your Pull Zone

The first thing you need to do is create your Pull Zone on GrandCDN. On the "Add New Pull Zone" page, you will need to enter a name for your Pull Zone (this will form its hostname), and set the origin to be your main website URL. We've got a guide on how to configure your Pull Zone here.

2. Editing your index.php file

In order to enable the CDN, you need to edit the index.php file. This is located on the root of your website, and you will need SSH/FTP/file level access to your web server.

Once you have the index.php file open, search it for the following bit of code:

// $assign_to_config['global_vars'] = array();

Once you have found this line of code, we need to edit it. We are going to make a global variable that is used when calling any static resources from an ExpressionEngine template. We need to uncomment the line and edit it so that it looks something like this:

$assign_to_config['global_vars'] = array('cdn_url' => '');

You will need to replace "" with the actual zone that you setup earlier. 

3. Use your new variable

You will now need to edit your template to use the new {cdn_url} variable. If you have already made a template, you will need to edit it to use the new variable. If you have not made a template, you will need to make one and use the new variable. 

An example of this would be:


4. Test your integration

Once you've setup your CDN, you should find that all your URLs for content inside your site has been rewritten to include the new CDN URLs which will include the Pull Zone URL you setup earlier.

If all that works, you have successfully deployed GrandCDN on your ExpressionEngine website and you will now enjoy all the performance boosts that GrandCDN will give you with our worldwide network, as well as potential bandwidth savings in the thousands of dollars.