PrestaShop Media Server with Cookie-free Domain via SSL

Updated on Jun 11, 2019

Introduction

PrestaShop provides a great way to service your content via cookie-free domain name via the Performance configuration settings called Media Server. Basically, setting a media server URL in your PrestaShop will improve your static content delivery, website performance and GTMetrix as your images, CSS and JS files will be serviced via cookie-free domain.

The Problem

We have already covered the steps needed to configure the PrestaShop Media Server URL on cPanel hosting account but many customers face an issue when having this setup while using SSL certificate for their stores. 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. In this situation you will be forced to either:

1) Consider purchasing a wildcard SSL to cover your subdomains as well *.domain.com

2) Activate CloudFlare CDN using their Universel SSL to convert your subdomain

Both solutions have some disadvantages – the WildCard SSL may be expensive especially if you do not really need SSL for your subdomains and the CloudFlare CDN applies security cookie to all the content processed via their network, so basically you still have cookies applied to your static content with the second option.

The Solution: Processing Static Content via Shared SSL and mod_userdir

Most hosting providers support the Apache mod_userdir which allows you to access your account via the server hostname using a URL such as http://hostname/~username where the ‘hostname’ is the server hostname and the ‘username’ is your cPanel username.

Additionally, most hosting providers, including FastComet, have valid and trusted SSL certificate installed for the server hostname, usually advertised as Shared SSL. In many cases, the Shared SSL is almost useless as you will most probably don’t want to have your website accessed via a third party URL but your domain name. In this case, however, the Shared SSL can be great to process your static content via cookie-free domain and still keep it secure via the https.

Unfortunately, PrestaShop does not accept URLs including ‘~’ character for the media server settings but with just a quick trick you can set this.

Before changing any settings on your PrestaShop installation, make sure your account is accessible via mod_userdir and a valid SSL is available on your hosting server. You may contact your host and consult if this option is available for you. All FastComet clients on our PrestaShop Hosting plans can take advantage of this feature completely free of charge.

If your host supports mod_userdir and have a valid SSL you can proceed to your PrestaShop admin panel, Performance section under the Advanced Parameters menu. Scroll to the Media Servers section and input any dummy URL such as:

static.domain.com

We hope you find this article useful. Discover more about FastCloud - the top-rated Hosting Solutions for personal and small business websites in four consecutive years by the HostAdvice Community!

SSD Cloud Hosting

  • Free Domain Transfer
  • 24/7 Technical Support
  • Fast SSD Storage
  • Hack-free Protection
  • Free Script Installation
  • Free Website Transfer
  • Free Cloudflare CDN
  • Immediate Activation
View More