Support

Find answers, guides, and tutorials to supercharge your content delivery.

X-Cart CDN Integration

Updated on December 20, 2021

This X-Cart CDN integration tutorial shows how to complete a CDN integration with KeyCDN.

For this X-Cart CDN Integration tutorial we're using the default skin called ideal_comfort. If you are using another skin you will need to modify the code shown below to match the name of your skin.

This tutorial works with X-Cart 4.4.x and later (fixed path to skin).

  1. Create a Pull Zone before you start with the X-Cart CDN integration.

  2. Go to the root directory of X-Cart and create a backup of the core X-Cart file smarty.php.

  3. Open the core X-Cart file smarty.php. Search for the following lines:

    $smarty->assign('ImagesDir', $xcart_web_dir . $smarty_skin_dir . '/images');
    $smarty->assign('SkinDir', $xcart_web_dir . $smarty_skin_dir);
    
  4. Two lines need to be replaced with your CDN URL (e.g. https://example-hexid.kxcdn.com):

    // KeyCDN Integration
    if ($_SERVER['HTTPS'] != 'on') {
        $smarty->assign("SkinDir","https://example-hexid.kxcdn.com/skin/ideal_comfort");
        $smarty->assign("ImagesDir","https://example-hexid.kxcdn.com/s/skin/ideal_comfort/images");
    } else {
        $smarty->assign("SkinDir",$xcart_web_dir."/skin/ideal_comfort");
        $smarty->assign("ImagesDir",$xcart_web_dir."/skin/ideal_comfort/images");
    }
    
  5. Save the changes.

  6. Check in the HTML to see if the URL has been rewritten properly.

Supercharge your content delivery 🚀

Try KeyCDN with a free 14 day trial, no credit card required.

Get started
KeyCDN uses cookies to make its website easier to use. Learn more