htaccess deny direct access to folder in website

.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.




Like http://websitename.com/images_folder

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

Leave a Reply

avatar
  Subscribe  
Notify of