Skip to main content

Integrate a CDN resource with b2evolution

Stock b2evolution installations can load static assets from a Orange's CDN custom domain by changing the asset URL variables in blogs/conf/_advanced.php. This method applies when the site still uses the default layout with that file, and the default asset URL variables ($rsc_url, $skins_url, $media_url) still build from $baseurl. If the installation exposes an Assets URLs / CDN panel in the admin UI instead, configure the custom domain there — see the b2evolution Assets URLs / CDN settings documentation.

Back up the site files and database before changing configuration. Editing blogs/conf/_advanced.php can take the site offline if the file is saved with a syntax error — keep a copy of the original file and restore it if the site fails to load after the change.

Before editing b2evolution, collect the custom domain value to put in $cdnurl (for example, cdn.example.com):

  1. 1

    Open the CDN resource

    In the CDB Customer Portal, navigate to CDN > CDN resources and open the resource.

  2. 2

    Copy the custom domain

    Note the custom domain shown for the resource — this is the hostname used in asset URLs and in $cdnurl.

  3. 3

    Confirm the DNS CNAME

    Confirm that the custom domain has a CNAME record pointing to the value shown on the Set up your DNS page (cl-****.gcdn.co). Do not put the gcdn.co hostname in $cdnurl.

  4. 4

    Confirm SSL

    Confirm the custom domain has a valid SSL certificate so assets can load over HTTPS.

Then update the b2evolution configuration:

  1. Open blogs/conf/_advanced.php in the b2evolution installation.

  2. Add a new variable near the top of the file, set to the custom domain with https:// and a trailing slash:

    $cdnurl = 'https://cdn.example.com/';
    
  3. Replace the following variable assignments so static resources load from $cdnurl instead of $baseurl:

    BeforeAfter replacement
    $rsc_url = $baseurl.$rsc_subdir;$rsc_url = $cdnurl.$rsc_subdir;
    $skins_url = $baseurl.$skins_subdir;$skins_url = $cdnurl.$skins_subdir;
    $media_url = $baseurl.$media_subdir;$media_url = $cdnurl.$media_subdir;
  4. Save blogs/conf/_advanced.php.

  5. Confirm the integration by opening the browser developer tools (press F12), selecting the Network tab, and refreshing the page — static files should load from the custom domain over HTTPS instead of the origin domain.