2

How to store the product images in another domain? for example, My site is www.mytestsite.com. We need to store the product image in subdomain as "media.mytestsite.com". Is it Possible?

We also try to change the media url in backend. But image not uploading. It say as "Unable to create directory 'media.mytestsite.com/media/tmp/catalog/product'. "

3 Answers 3

2

It sounds like you are trying to write your media to another server rather than just serve them from a different domain. This isn't possible through configuration in magento. Even if you could you would need the media on the magento server as magento checks on its local filesystem to see if a file exists before serving it to the browser, you would end up with a page of placeholder images.

What you could do to achieve what you are after is use an external disk which is shared via nfs and mounted on both your magento and media servers. That way your media is written locally from magento but available on your second server through the shared drive.

That said, I'm not sure your requirements but a CDN solution may be a better option for you.

-1

Rat, yes, it is possible. Adding your subdomain in System -> Configuration -> Web -> Unsecure -> Base Media URL and System -> Configuration -> Web -> Secure -> Base Media URL is proper way of doing that.

You also need to subdomain points to media/ directory.

For second issue, make sure media/ directory and its subdirectories are writable by web server.

6
  • Hi, I set the Media url. But image not uploaded. And Media folder also set write permission.
    – Rat
    Commented Dec 4, 2014 at 8:26
  • And i have checked for the image and uploaded in media folder in the application server. Where to change the upload folder path?
    – Rat
    Commented Dec 4, 2014 at 8:40
  • So does it uploads properly, but do you want to have it uploaded into different server? Commented Dec 4, 2014 at 16:23
  • yes. We need to store the product images in different server. I have changedthe config media URL as mentioned above, images uploaded in default media directory.
    – Rat
    Commented Dec 6, 2014 at 5:32
  • Magento allows to configure path from which media files are being served but it doesn't let you to configure server/path into which they should be uploaded. You may need to check for some CDN solution eg. OnePica ImageCDN extension to have images synchronized between your media directory and external server. Commented Dec 6, 2014 at 8:51
-1

Yes It is possible.

  1. Create a Sub-domain named "media.mytestsite.com".
  2. Copy the media folder to your sub-domain's root folder.
  3. Give the permission 777 to media folder. (Full permission).
  4. Go to you magento admin.
  5. Go to System -> Configuration -> Web -> Unsecure -> Base Media URL and put "http://media.mytestsite.com/media/".
  6. Go to System -> Configuration -> Web -> Secure -> Base Media URL and put "https://media.mytestsite.com/media/".
  7. Now save the configuration.
  8. Clear/Refresh magento cache.(It is very important)
  9. You have done it all... :) Enjoy..
1
  • @ Shoeb Salil : Is it above your steps helps Magento speed?
    – Gem
    Commented Apr 21, 2017 at 10:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.