Enable CDN in Prestashop and Resolve related issues - How to do it ?

Are you trying to enable CDN in Prestashop?

We can help you.

PrestaShop is an open-source eCommerce platform that allows us to run our online store either via self-hosting or in the cloud.
At times we may find Prestashop slowing down, we can use CDN to speed it up
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to enable CDN in Prestashop.

How to enable CDN in PrestaShop ?

To Integrate CDN with PrestaShop, follow the steps given below.
Firstly, we must take a backup of files and database.

If we wish to integrate a CDN service on https:// pages also, then we must use the CDN domain with SSL enabled.
If our website embeds custom fonts, then we must enable CORS first.
Also, ensure that the CDN domain is ready to use.

Steps for Enabling CDN in PrestaShop:

1. First, log in to the PrestaShop admin panel.

2. Then go to Advanced Parameters and take Performance.

3. Now, we must configure CCC (Combine, Compress, and Cache).

Smart Cache for CSS: Yes
Smart Cache for JavaScript: Yes

4. After that click Save.

5. Finally, we must configure Media servers (use only with CCC) and click Save.

Setting a media server URL in PrestaShop will improve static content delivery, website performance, GTMetrix as images, CSS, and JS files will be serviced via a cookie-free domain.
View HTML source code of web pages to verify that we are using CDN, we should see the source attribute of our images, CSS, JavaScript, etc. beginning with the CDN domain.
If we do not see our CDN domain in the source code of our web pages, then the website may be using any cache plugin/mechanism.
We can clear the cache and check again. Next, we will see the common error that we may face while enabling CDN.

How to resolve Common error faced while enabling CDN in PrestaShop ?

While configuring the PrestaShop Media Server URL, many customers face an issue when having this setup while using SSL certificate for their stores.

Cause for the error

The reason for the issue is that usually the SSL is valid for their main domain www/.domain.com and does not cover the Media Server subdomain used for cookie-free URL.

How to fix this error ?

Following are the steps to fix the above error:
1. Purchase a wildcard SSL to cover the subdomains as well *.domain.com.
2. Activate Cloudflare CDN using their Universel SSL to convert subdomain.
3. Processing Static Content via Shared SSL and mod_userdir

Most hosting providers support the Apache mod_userdir which allows to access the account via the server hostname using a URL such as http://hostname/~username.
Additionally, most hosting providers have valid and trusted SSL certificate installed for the server hostname, usually advertised as Shared SSL.
This Shared SSL can process static content via a cookie-free domain and still keep it secure via the https.
Unfortunately, PrestaShop does not accept URLs including ‘~’ character for the media server settings. However, we can set this with just a quick trick.

The steps to follow are given below:

1. Before changing any settings on PrestaShop installation, ensure that the account is accessible via mod_userdir and a valid SSL is available on the hosting server.
2. Log in to the PrestaShop admin panel and navigate to the Performance section under the Advanced Parameters menu.
3. From there take Media Servers and input any dummy URL such as static.domain.com

[Need assistance in fixing Prestashop errors? We can help you. ]


This article covers how to enable CDN on PrestaShop for our customers.
You can Speed up your website with the PrestaShop CDN addon.
Faster loading leads immediately to happier users and higher conversions.
Making your pages load faster will also improve your SEO.
Google ranks faster websites higher, so you'll soon receive more visitors from search engines.

To How to Enable CDN for Prestashop:

1. Make sure Prestashop is installed and work normally.
2. Login to Prestashop admin panel (e.g. http://prestashop.testing.com.my/admin1234/)
3. Navigate to Advanced Parameters > Performance.
4. Scroll down the page to Media servers and fill in the CDN hostname.
5. Click Save at the top right corner to save the setting.