.htaccess tutorial - Directory listing/indexing on websites

all kinds of tutorials and guides. how, where, why, step-by-step stuff and more. also support for those tutorials and guides. ONLY post step-by-step guides/tutorials here OR reply with question if you have any.
Post Reply
User avatar
Sethioz
Admin
Admin
Posts: 4764
Joined: Fri Jul 27, 2007 5:11 pm
Custom: Gaming YT > https://youtube.com/SethiozEntertainment
Game Hacking YT > https://youtube.com/sethioz
Game Hacks Store > https://sethioz.com/shopz
Location: unknown
Contact:

.htaccess tutorial - Directory listing/indexing on websites

Post by Sethioz »

This tells you how to turn on and off directory indexing (listing) on websites.

* To enable directory listing, add this line into your ".htaccess" file:

Code: Select all

Options +Indexes
* To disable directory listing, add this line into your ".htaccess file:

Code: Select all

Options -Indexes
now lil explanation, if you want directory indexing to be off on whole website, then all you need to do, is add the disable line into .htaccess file that is in the root of your website, for example to me it would be "http://sethioz.com/.htaccess"
this will disable direcotry indexing in every sub-folder too.

if you want to enable it on whole website, do same.

if you want to disable / enable it in specific directory, then add the opposite into that directory.
for example if you have disabled indexing on whole website and want it to be enabled in like "yoursite.com/blah/doh" then add enable line into the .htaccess file that is in that directory (yoursire.com/blah/doh/.htaccess" < there)


* To ignore file types:

Code: Select all

IndexIgnore *.bat *.exe
This will ignore .bat and .exe files, rest will be shown.


* To replace index file with something else:

Code: Select all

DirectoryIndex customindex.php
where "customindex.php" is the file you want to show instead of index.php (index.html, index.htm)
Post Reply