.htaccess maker

.htaccess generator maker easier

Htaccess Prevent directory listings or enable folder listing

Using htaccess to prevent directory listings can be helpful in so many ways, if you have key directories with important zips, and archive files or you simply want to prevent others from viewing your image directories.

In order to disable directory listings, simply create .htaccess file and put the following instruction in it, it will block folder listing.

IndexIgnore *

This command line will instruct the server to disable the directory listings and all those files within the directories that contain .htaccess file. The * symbol in the command line will simply prevent the directory from displaying any file .

It is possible to use htaccess to prevent or disable the display of some specific types of files, if you want to disable the display of zip files for instance, simply create the .htaccess file, and use the following code line in it

IndexIgnore *.zip

Another example, if you want only to hie images of the type JPG, GIF or PNG you can use the same instruction as the following

IndexIgnore *.jpg *.gif *.png

On the other hand, if your server is preventing listing folders by default and you want to enable it you can use the following piece of code

Options +I

Your .htaccess File

Download Copy

You can create the .htaccess file using a good text editor like TextPad, UltraEdit and Microsoft WordPad. You cannot use Microsoft NotePad. An .htaccess file can contain a single or multiple lines depending upon the functions you want to include in it. You will need to use an FTP (File Transfer Protocol) program to upload the file. Also you must to upload the file in “ASCII” mode. Some FTP programs use “BINARY” as the default to upload files. If that’s the case you must change it to “ASCII”. Upload the file to the directory you want it to reside in. when you look at the files in your website’s directory you might not see it as your web server’s software is probably hiding it.

Prevent Directory Listing

Block access to Directory Listing

Copyright © 2021 · htaccessmaker.com · Log in