0

On one of my websites, a user can access the URL site.com/galery. There is no index.html / .php file in this folder so Apache is just listing every single images of the directory galery.

I was wondering, is it possible (using htaccess) to deny direct access to this folder (by typing site.com/galery) but still allow a user to see images from this folder with

<img src="galery/myPicture.jpg" alt="">

EDIT : This topic is not a duplicate. The proposed topic's solutions does not allow to view images as asked in mine.

Thanks !

KbroL
  • 3
  • 5

1 Answers1

1

add an .htaccess file in this folder with:

Options –Indexes
shushu304
  • 1,506
  • 1
  • 7
  • 15
  • actually you can add this line in the main public html folder .htaccessf file, and all the sub directories that don't have htaccess file ... will be affected too as well. – shushu304 Apr 06 '19 at 08:03