Updated on Jun 11, 2019
If you have been browsing your PrestaShop Advance Parameters section you might have noticed the Media Servers option under the Performance menu of your admin panel. In this guide, we will show you how to easily set up a Media Server on your PrestaShop Hosting account.
First, let's explain why we need a Media Server to improve performance. This option allows you to configure a cookieless domain or subdomain via which your static content will be delivered. When serving static content from a different domain you will avoid unnecessary cookie traffic. When the browser requests a static image and sends cookies with the request, the server ignores the cookies. These cookies are unnecessary network traffic. To work around the issue, you can use a separate domain or subdomain, which hosts only your static files.
Most suggested configurations on the net suggest using a separate location for your static content and even purchasing a separate domain for this purpose. All this is great but might result in some unnecessary troubles and extra expenses. In this guide, we will show you how to use your existing domain and set up the Media Server without the need to modify your PrestaShop configure files.
First, create a subdomain via your cPanel and make sure its document root folder is pointed to the same folder as your main domain name. For example, if you have your domain.com pointed to the
public_html directory of your account, set your subdomain static.domain.com routed to the same directory.
When you have your static subdomain created login into your PrestaShop admin and navigate to the Advanced Parameters -> Performance menu.
Scroll to the CCC settings and make sure you have all the options enabled.
Save the settings and scroll to the Media Servers settings. In the first field enter your static subdomain URL and save the settings.
Now you should have your static content processed via your new subdomain, which will greatly improve your YSlow score and improve your GTmetrix rating.
Some important notes to consider:
If you have Cloudflare enabled for your static subdomain GTmetrix will always report that your content is not serviced via cookieless domain. This is because Cloudflare adds a cookie to every request. Still, this does not negatively affect your site performance, on the contrary - if you do not want to use Cloudflare CDN globally for your domain but you still would like to have your static content processed via the CDN this is an excellent way to achieve this.
Secondly, setting up multiple subdomains all pointed to your account will not improve your website any further. A single subdomain using this setup is completely sufficient.
Thirdly, the configuration suggested above does not require any configuration modifications on your PrestaShop config files and newly uploaded images and static content will automatically be accessible. In case you decide to use a separate folder or server for the static content you might need to reconfigure your PrestaShop configuration files.
Last but not least, in case you have HTTPS enabled for your store you will need to make sure that your static subdomain or domain is also accessible via https and configured appropriately in the Media Server configuration. Otherwise, you will end up with SSL warnings. A possible solution can be to either route your static subdomain via Cloudflare and set it to an https-only mode or get a wildcard SSL to cover your static subdomain as well as your store domain.
If you experience any difficulties to configure the PrestaShop Media Server, our techs will be glad to set it up for you on our PrestaShop Hosting plans completely free of charge. You may also check our PrestaShop Tutorial for additional how-tos and step by step instructions on how to configure your online store.
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!