Magento2 is looking directly in the root folder for media and static files. It is not looking in pub/media folder. Product images are not showing in the front. I installed Magento 2 in a subdirectory and with the installation.

I imported the products with Storemanager Emagicone, images were in import file (in root/media and pub/media because i did not know which to use),

Product images are in the front referring to a wrong path:


When I look in FTP, the images are in pub/media/catalog/product. The above-mentioned directory is totally empty.

Moving the files from root/pub/media to root/media solved partially the problem. All basic images show up, but product images are not showing at all.

I already tried:php bin/magento setup:di:compile and php bin/magento setup:static-content:deployand php bin/magento cache:clean and php bin/magento indexer:reindex

The file permissions and user owner are OK, also i deleted all from ROOT > pub > static > EXCEPT .HTACCESS. I also deleted folder in: pub/static var/cache, var/view_preprocessed/css/frontend/ , ..source/frontend

I also looked in di.xml Magento\Framework\App\View\Asset\MaterializationStrategy\Copy

No symlinks!

  • Did you manage to fix this. Please provide the answer.
    – tread
    Commented Nov 9, 2016 at 10:57
  • 1
    Did you check your store configuration? I guess you didnt set your media path or even when, false. Commented Dec 23, 2016 at 20:22
  • Not sure if this is your problem, but the document root should point to <magento root>/pub.
    – Zsolti
    Commented Mar 2, 2020 at 20:17

6 Answers 6


For individual product, try saving the product in admin without any change.

For all products, try running the following command (this will take some time to complete):

php bin/magento catalog:images:resize
  • I am facing with error in Magento 2.3.4: Notice: Undefined index: keep_aspect_ratio in vendor/magento/module-media-storage/Service/ImageResize.php on line 308
    – huykon225
    Commented Aug 7, 2020 at 1:33

Please make sure to double check owner and group of pub/media directory.

You may run this command from magento root directory:

sudo chown www-data:www-data -R pub/media

Assuming www-data is used as Apache user.

Apache user should have permissions to a pub/media/catalog/product directory to create resized product image files.

Hope it helps.

  • Tried it but got Required file '/var/www/html/pub/media/catalog/product/watermark/ ' does not exists. Commented Apr 16, 2021 at 5:34

1) Open di.xml from app\etc\di.xml

2) Search by Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink and use word Copy instead of Symlink so the final string will be


3) Save this file and remove everything from pub/static except .htacess

4) Through CMD. Clear your cache 5) Flush your cache 6) Do Reindexing

This time, images should be loaded.


I have tried everything but no luck. This article finally helped me fix issue


All you need to do is login to your db via phpMyAdmin (or similar), go to catalog_product_entity_varchar, search for records with value LIKE "no", you will find that few images may have no_selection as their value. Just remove all of those records.

Images should then display correctly


You may want to try: php bin/magento catalog:images:resize

If You're using watermarks, ensure those are also in place in pub/media/catalog/watermark/default

  • Sometimes running the Image Resize Function ensures that the Product Images are properly generated, and in some cases where watermarks are used, missing water6mark files will break the images being made.
    – J Harvey
    Commented Jul 7, 2021 at 15:28

php bin/magento catalog:images:resize

php bin/magento indexer:reindex

php bin/magento c:f

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.