Magento – change image upload location

locationsmedia

By the default Magento save the images to: www.domain.com/media folder

i would like to change the location of the saved images to subdomain: images.domain/media

I have made changes through the configuration: configuration -> web -> Base Media URL and have cleared the catch, but the images are not uploading. Also, i have made change the permission for the folder 777.

any idea what i'm doing wrong and how this can be done?

updated 12.09.2015.
i found the following, which is exacly what I did, but this is not working:

Create a Sub-domain named "media.mytestsite.com".
Copy the media folder to your sub-domain's root folder.
Give the permission 777 to media folder. (Full permission).
Go to you magento admin.
Go to System -> Configuration -> Web -> Unsecure -> Base Media URL and put "http://media.mytestsite.com/media/".
Go to System -> Configuration -> Web -> Secure -> Base Media URL and put "https://media.mytestsite.com/media/".
Now save the configuration.
Clear/Refresh magento cache.(It is very important)
You have done it all… 🙂 Enjoy..

Best Answer

Create a Sub-domain named "media.mytestsite.com". Copy the media folder to your sub-domain's root folder. Give the permission 777 to media folder. (Full permission). Go to you magento admin. Go to System -> Configuration -> Web -> Unsecure -> Base Media URL and put "http://media.mytestsite.com/media/". Go to System -> Configuration -> Web -> Secure -> Base Media URL and put "https://media.mytestsite.com/media/". Now save the configuration. Clear/Refresh magento cache.(It is very important) You have done it all... :) Enjoy..

These are instructions for having the front end put the sub domain for img src tags. As for uploading images in the admin panel... this is a different story.

If this is a dedicated web server, you can simply make your sub domain vhost and point it to your document root. This would be my suggestion.

If your subdomain is a different server or on a cheap cpanel server, then your going to have to script something or use rsync to transfer the images from the main site to the sub domain site every 5 minutes or so.

There are also modules available that might do this stuff automatically for you. You would need to look into cdn modules and see what's available an what fits your needs.

Related Topic