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. – stephen Nov 9 '16 at 10:57
  • 1
    Did you check your store configuration? I guess you didnt set your media path or even when, false. – David Lambauer Dec 23 '16 at 20:22
  • Not sure if this is your problem, but the document root should point to <magento root>/pub. – Zsolti Mar 2 at 20:17

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
| improve this answer | |
  • 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 Aug 7 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.

| improve this answer | |

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.

| improve this answer | |

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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