I have a phtml file in my theme that is added to category page via XML updates tab.

I read image in phtml like so:


My theme has 2 store view nl-be, fr-be and one of them has store code to url like so:

NL-BE = https://magento2.com/media/catalog/category/image.jpg

NL-FR = https://magento2.com/fr-be/media/catalog/category/image.jpg //THIS IMAGE GOES 404

Anyone any idea?


2 Answers 2


Basically you need to create Symlinks for the same Directory.

If you don't know, how to Symlinks then please refer this link:

  • in my opinion the images should return 200 out of the box I can see that magento native itself doesn't add the store code to any images urls either another options is to use: <?php $objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $conf = $objectManager->get('Magento\Framework\App\Config\ScopeConfigInterface')->getValue("web/unsecure/base_url", "\Magento\Store\Model\ScopeInterface::SCOPE_STORES");?> Oct 1, 2019 at 13:51

If you have having store codes in URL's then to get the media files correctly working you need to add symlinks in the corresponding directory for your store view for media as follows

ln -s source destination


ln -s ../pub/media media

This if for linux.

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.