INCLUDE_DATA
When a web browser is pointed to a directory on your web site which does not have an index.html file in it, the files in that directory can be listed on a web page.
1. Enable/Disable Directory Listing
To have the web server produce a list of files for such directories, use the below line in your .htaccess.
1 | Options +Indexes |
To have an error (403) returned instead, use this line.
1 | Options -Indexes |
2. Listing Style
Either a basic list of files can be shown, or a ‘fancy’ list including icons, file size, modification date and more.
Add this to your .htaccess file to use the ‘fancy’ style.
1 | IndexOptions +FancyIndexing |
Use this line if you prefer a more basic file list.
1 | IndexOptions -FancyIndexing |
3. Ignore Files
Let’s say you have a directory with .jpg, .gif and .png image files. You only want the .png files to show in the directory listings. Add this line to your .htaccess.
1 | IndexIgnore *.gif *.jpg |
The web server now ignores the .gif and .jpg files.
4. Modify Index File
Maybe you don’t want a list of the files, you want a specific file to be shown instead. You could upload an index.html file in this directory. There is another way.
1 | DirectoryIndex myfile.html |
Instead of listing the files, web page myfile.html will now be shown for this directory and its subdirectories.
Email This Post
|
Print This Post
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ||
| By N2H | ||||||||
3 Comments for ".htaccess Tutorial – Directory Listing"
Dear Admin,
Thank you so much for your computer tips, articles and utilities. Now, I need your small help, do you mind?
Now, I want to know what is wildcarded subdomains and “The wildcards must point to the web root directory”: Please let me know with example how to do it. I have personal webserver and domain name but I am not expert in Web Developer. Please help me!
(I can see wildcarded in the control panel but I don’t know how to use it)
Thanks,
Merosansarma
Hi,
I have added new blog for Wildcard DNS, you can read it at http://www.myblog.com.np/2007/09/03/what-is-a-wildcard-dns/
Regards,
Prakash
I have hosting account on a windows server and have many scripts which need php and other prerequisites. There is always a file .htaccess with those scripts which needed to be edited but it never shown on my windows host after uploading all files. Is there any way to show that file in windows hosting panel? It HSPHERE which is being used by the host.
Leave a reply