.htaccess file is used for security purpose also. Anybody can open direct your folder by typing the folder name with your provided URL Link and steal your all files from that folder.
For example if you enter your image folder name with URL Link and click this link then it will show you all the files which are present in that folder if thereâs no security provided.
So to protect your websiteâs folder, you just have to write a simple code in your htaccess file, which is given below. It will not give permission to open the files direct:-
create file .htaccess and copy paste below code.
# directory browsing Options All -Indexes