How to Prevent a Directory Listing of Your Website Without Using .htaccess

Alternative Ways to Suppress a Listing of Web Folders

How to Prevent a Directory Listing of Your Website Without Using .htaccess

by Christopher Heng,

One of my visitors was concerned that her website displayed a listing of all the files contained in a particular directory (folder). (If you don't know what I mean, take a look at this directory on Mozilla's server, where the listing is deliberately allowed, so that advanced users can quickly get specific versions of Firefox that are otherwise not easily obtained through the main website's user interface.) She had read my article on How to Prevent a Directory Listing of Your Website with .htaccess but wanted to know if there was a solution that did not involve modifying the .htaccess file.


Although my visitor did not disclose her reason for wanting a non-htaccess solution, from experience with others who have asked this question, my guess is that it is probably one of the following reasons:

Alternative Ways to Block a Directory Listing

In reality, the alternatives to using .htaccess are just as effective, and if you are a non-technical person, they are arguably easier to do. Here are the most obvious two that I can think of.

Disadvantages of Using These Alternative Methods

There are some minor disadvantages of using these solutions instead of a .htaccess file.

None of these disdvantages are crippling, so use whichever method you prefer. In general, between the two alternatives, I think the index.html method is marginally better, since it is more portable. That is, it does not rely on your web host having the required feature in their control panel, and if you need to, you can move your site to any web host without having to keep track of yet another thing to update.

Copyright © 2019 Christopher Heng. All rights reserved.
Get more free tips and articles like this, on web design, promotion, revenue and scripting, from

thesitewizard™ News Feed (RSS Site Feed)  Subscribe to newsfeed

Do you find this article useful? You can learn of new articles and scripts that are published on by subscribing to the RSS feed. Simply point your RSS feed reader or a browser that supports RSS feeds at You can read more about how to subscribe to RSS site feeds from my RSS FAQ.

Please Do Not Reprint This Article

This article is copyrighted. Please do not reproduce or distribute this article in whole or part, in any form.

Related Articles

New Articles

Popular Articles

How to Link to This Page

It will appear on your page as:

How to Prevent a Directory Listing of Your Website Without Using .htaccess

Link to Us
No Spam Policy
Privacy Policy
Site Map

Getting Started
Web Design
Search Engines
Revenue Making
Web Hosting
Perl / CGI
.htaccess / Apache


Free webmasters and programmers resources, scripts and tutorials Free How-To Guides
Site Design Tips at
Find this site useful?
Please link to us.