Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Mask/Rewrite Image Locations for Multi-Store Setup
 
J_T_
Mentor
 
Avatar
Total Posts:  1961
Joined:  2008-08-07
London-ish, UK
 

Hi,

My Mage installation resides in http://www.ourcorporatesite.tld/mage/ - the front end of this is inaccessible.

Through a multi-store setup, I run front-end shops on http://www.shop1.tld and http://www.shop2.tld etc.

I upload images in the admin back-end on the corporate site and hence, the location becomes http://www.ourcorporatesite.com/mage/media/catalog/product/cache/3/small_image/135x135/5e06319eda06f020e43594a9c230972d/f/p/imagename.jpg on all the front-end shops.

Is there any way I can rewrite those image urls so it looks as if they are on the same domain?

This both obfuscates where the Mage file resides and prevents SSL issues as well as making sure the front-end shop domain is referenced in Google images etc. and not my corporatesite.tld

If I change Base Media URL for this Website to its own domain, the image locations become as desired but obviously don’t load. I wonder if I can add a rewrite rule that checks for “media” in the URL and rewrites it to fetch these from the corporate site. Rewrite conditions aren’t my strongest point unfortunately…

Did anyone else solve this already?

Or perhaps, as they are on the same server, would a symlink suffice?

 
Magento Community Magento Community
Magento Community
Magento Community
 
J_T_
Mentor
 
Avatar
Total Posts:  1961
Joined:  2008-08-07
London-ish, UK
 

To answer my own question…

Yes, a symlink would suffice.

In the root of the shop1.tld and others…

# ln -s /var/web/ourcorporatesite/mage/media media

Then set Base Media URL to the actual domain you want.

Same counts for JS and Skin folders. With those done it becomes completely obfuscated where the files actually reside…

 
Magento Community Magento Community
Magento Community
Magento Community
 
nileco
Sr. Member
 
Avatar
Total Posts:  79
Joined:  2008-10-29
Virginia
 

Hey J.T.,
Could you expand on this a little?

In the root of the shop1.tld and others…

As always your shared work is MOST appreciated.

Chris

 
Magento Community Magento Community
Magento Community
Magento Community
 
J_T_
Mentor
 
Avatar
Total Posts:  1961
Joined:  2008-08-07
London-ish, UK
 

It depends on your folder structure but you basically symlink an empty media folder on the public site to the media folder with images on your Mage install.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top