Setup CDN in a PHP Project

Search the Knowledgebase


Setup CDN in a PHP Project

March 5, 2020

In this article, we will set up GotiPath CDN with your PHP Project.

1. Take your CDN URL / Pull Zone URL from our dashboard

After login into your GotiPath Dashboard you will see your CDN URL under “Content Delivery Network” > Domain > View


2. Using a PHP CDN Implementation Without a CMS or Framework

If you need to perform a custom PHP CDN integration, you can do so by using a global variable within your PHP code. Once the global variable is defined, you can then prefix your asset URLs with this variable. For instance, let’s say you have an index.php file and want to define a global variable to be called within your HTML. Your first step would be to define the variable with a name such as CDN and a value which will correspond to your CDN URL (e.g. or In this case, your index.php file may look something like this.

    define('CDN', '');
        <!-- (generated server side from less/style.less) -->
        <linkrel='stylesheet' href='<?php echo CDN ?>css/style.css' />
        <scripttype='text/javascript' src='<?php echo CDN ?>js/script.js'></script>
        <p>Lorem Ipsum</p>
Some developers puts images into a subdomain like than you just have to create a CNAME by set this domain as origin domain.  If you need some integration help kindly know us we will be more than happy to help.
Did you find this article helpful?
2 out of 2 found this helpful
Still have questions? Open a Support Ticket

Related Stories