> ## Documentation Index
> Fetch the complete documentation index at: https://docs.preprod.world/llms.txt
> Use this file to discover all available pages before exploring further.

# Integrate a CDN resource with b2evolution

Stock b2evolution installations can load static assets from a Gcore CDN [custom domain](/cdn/cdn-resource-options/general/create-and-set-a-custom-domain-for-the-content-delivery-via-cdn) 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](https://b2evolution.net/man/assets-url-cdn-settings) documentation.

<Warning>
  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.
</Warning>

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

<Steps>
  <Step title="Open the CDN resource">
    In the [Gcore Customer Portal](https://portal.gcore.com), navigate to **CDN** > **CDN resources** and open the resource.
  </Step>

  <Step title="Copy the custom domain">
    Note the **custom domain** shown for the resource — this is the hostname used in asset URLs and in `$cdnurl`.
  </Step>

  <Step title="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`.
  </Step>

  <Step title="Confirm SSL">
    Confirm the custom domain has a valid SSL certificate so assets can load over HTTPS.
  </Step>
</Steps>

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:

   ```php theme={null}
   $cdnurl = 'https://cdn.example.com/';
   ```

3. Replace the following variable assignments so static resources load from `$cdnurl` instead of `$baseurl`:

   | Before                                 | After 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.
