In the article, I will guide you to add media servers in Prestashop 1.6 and Prestashop 1.7. A media server is another domain of your store, which is used to load cookieless static content. What's the advantage of adding media servers, adding at least one media server to your site would speed up your site. Please take the following steps to add a media server to your Prestashop 1.6 and Prestashop 1.7.
1. Register/buy a new domain for your store.
Register another domain domain, generally at the same place where you registered your main domain. Point the new domain also to your hosting's DNS servers, that will take 2 - 24 hours to take effect. If you don't know how to do, please contact your hosting provider to get help.
2. Adding a domain alias to you store.
Log in your cPanle, and locate to the "Domains" section, click the "Alias" button:
Then type the new domain here, and then click the "Add domain" button:
Now the domain alias is added to your store, you can access to your store via the new domain after few hours, as it will take some hours to take effect.
3. Adding a media server to Prestashop
When the new domain is available, log in to the back office of your store, locate to Config > Advanced parameters > Performance >Â MEDIA SERVERS (USE ONLY WITH CCC), add the new domain to the "Media server #1". if you have the other domains, you can add them to the "Media server #2" and the "Media server #3", but which aren't necessary usually, one media server is enough.
4. Regenerating .htaccess file
You would find the new domain still can't work fine, as it will be redirected to the main domain by the .htaccess, so you need to regenerate the .htaccess file. Go to BO > Config > Shop parameters > Traffic & SEO in Prestashop 1.7 (The path is BO > Preferences > URLs & SEO in Prestashop 1.6), just deactivate the "Friendly URL" option and save it, then activate the "friendly URL" option and save it again. Now the media server can work fine. Don't forget to clear the Smarty cache.
5. Is the media server working now?
You can use the developer tools of chrome or firefox to inspect it. Let's use chrome browser as an example, press F12 to enable the developer tools, and click the "network" tab and "Img" tab, press F5 to reload the page, then you will see a lot of requests on the console, just move the mouse to a request, you will see the media server is applied on it:
Does Google not mark this as a duplicate site?
Welcome.
I did exactly as described above but the photos are loading only as I copy the folders with photos and css styles from the main site to the subdomain.
I re-generated the .htaccess file and cleared the cache but when I delete the folders it doesn't load photos or css
No need to copy content to the subdomain, just point the subdomain to the folder of your main domain.
Hi Jonny,
I have added successfuly media servers, it"s working properly, but when I use gtmetrix it tells me that my domain is not cookies free even if the images are loaded from the subdomain.
What is your opinion?
Thanks
"There are 44 components that are not cookie-free
https://images1.aqua6.info/modules/stthemeeditor/views/css/customer-s1.css?4917
https://www.aqua6.info/img/prestashop-logo-1553878153.jpg
https://images2.aqua6.info/141-home_default/testeur-electronique-de-sel.jpg
https://images2.aqua6.info/557-home_default/ampoule-a-leds-osram-mr16-46w.jpg
https://images1.aqua6.info/600-home_default/electrolyseur-de-sel-monarch.jpg
https://images2.aqua6.info/639-home_default/pressostat-danfoss.jpg"
Hi,
Generally, the subdomain will be considered to be a domain with your main domain. so the test tools didn't detect it, you can try registering a new domain and point to your aqua6.info, then add the new domain to the media server, that can work fine.
Best regards.
Hello!
Please tell me how to set up an alias if I do not use any control panel?
I'm use nginx as a web server.
Oh, that's beyond me, contact your hosting company for help or Google for tutorials.
I get this error
GET https://media1.xxx. host/img/m/69-mf_image.jpg net::ERR_CERT_COMMON_NAME_INVALID
I think it has to do with the ssl of my main .com address being different from the .host media server address.
How can I resolve this?
Hi, it's not working if SSL is enabled on all pages. If I inspect image url, it shows: https://media.my-domain.com/9074-home_default/image.jpg. If I go there in browser, it says the the adress is not secure, if I click go there anyways, the picture is shown. I have SSL sertificate on my main domain and there's no option to make subdomain SSL encrypted in "cpanel". My address is: http://www.muzi.lt
well server support told me to buy SSL sertificate for subdomain, unfortunately they give it for free only for domain, but not for subdomain alias.. Works without ssl though 😉
sorry
hi Jonny, I followed the steps you indicated but I disappear the images (attached result screen)
https://drive.google.com/file/d/1PBS_FNmUa3mdctZsWMINeMc2f1X9d6P5/view?usp=sharing
https://drive.google.com/file/d/1nJLKyGYc2TtC_SIKix1GNbdsj3hkUB9n/view?usp=sharing
You probably did the #2 step wrong, a media server should be pointed to your site's root folder too. You can use this way to check, for example, this is your logo http://www.yourdomain.com/img/actuel-b-logo-1462554619.jpg, then you should be able to browser your logo via your newly added media server, like this mediaserver.yourdomain.com/img/actuel-b-logo-1462554619.jpg
Hi Jonny You were right, my mistake was in step 2, I was using a subdomain instead of an alias : P
Now it works well.
Thank you very much.
Hello,
Thanks for your tuto.
I created a subdomain like media1.mysite.com. Do I have to create also the same with www before ?
Is there any consequence on SEO ? As images URLs change.
You don't need to create www on it, but your media1.mysite.com should point to the same folder as your mysite.com. if you want to improve the SEO, I suggest you add CDN.
Thanks for this tuto ! Before to read this, I red on the Prestashop forum to create alias for my domaine. For example if the website is http://www.mysite.com => media1.mysite.com. After disabling /enabling the SEO, emptying the cache, I loocked the result with the inspecteur of Google. But only a few images are on media1. Not all. Are there a reason ? Thanks!!
Which theme you are using, I guess those images are banner images or images from custom content blocks, their urls are not generated by prestashop.
Thanks for your reply ! It's the Classic theme -PS1.7) but i think you're right : effectivly, product images are correctly associated with the cdn but not image in any custom block. Is it possible to change that to have a beter note on Google PageSpeed ? Thanks
Change them manually.
What dou you mean ?
Edit custom content blocks to change urls to something like this //media1.mysite.com/xxxx.jpg
Hi!
And if the site is already working? Whether it is necessary to transfer all pictures or any section of the website on media server because I have turned out the page without styles and pictures at start of media 1 ...
What if all the images disappear, maybe I did something wrong?
Tnx
1. Did you clear the Smarty cache and regenerate .htaccess file after adding a media server.
2. It's recommended to add one media server, you site will be speed up by do that.
3. To add a media server doesn't mean you have to transfer images to another server, you can keep images at where they are, just using another domain to load them.
Hi Jonny
Yes, I did everything according to your instructions, but I got the site without pictures and without styles.
Is it possible that my file .htaccess is processed correctly due to the fact that I am using a dedicated server VDS and need some additional configuration.
What code should be added to the file .htaccess? I want to check it.
You just need to regenerate .htaccess file, no needs to added any codes into it. I can't tell what's wrong according to your description. Contact your VDS server provider to see if they can help you check.