cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2 - Cannot access media files under customer

Magento 2 - Cannot access media files under customer

Hi There,

 

I'm unable to access media files under pub/media/customer due to .htaccess restriction below: 

 

<IfVersion >= 2.4>
    Require all denied
</IfVersion>

 

I'm not sure at what event/action, magento generates .htaccess for pub/media/customer. I  deleted .htaccess under pub/media/customer and did below cli commands. yet no .htaccess is generated. 

 

php bin/magento setup:upgrade && bin/magento setup:di:compile && php bin/magento cache:flush

But after some time, I'm facing in accessing media files under pub/media/customer, due to same .htaccess issue. Can anyone help me on 

 

  1. At what event Magento 2 generates .htaccess ?
  2. please help me to override .htaccess under pub/media/customer