Htaccess: Prevent Directory Listing: Difference between revisions

no edit summary
(Punctuation and grammatical changes; some clarification.)
No edit summary
Line 22: Line 22:
Sometimes I use the term folder and at other times directory; these are interchangeable and mean the same thing, so forgive me when I do this.
Sometimes I use the term folder and at other times directory; these are interchangeable and mean the same thing, so forgive me when I do this.


If you have read the [Htaccess: Site error documents | site error documents page]] you will have created a folder named '''error'''. Type the following into your browser address bar: '''<nowiki>http://localhost/errors/</nowiki>''' and you will be greeted with a full listing of its content (folders and files).
If you have read the [[Htaccess: Site error documents | Site error documents page]], you will have created a folder named '''error'''. Type the following into your browser address bar: '''<nowiki>http://localhost/errors/</nowiki>''' and you will be greeted with a full listing of its content (folders and files).


Try it on any folder that does not contain one of the following pages:
Try it on any folder that does not contain one of the following pages:
Line 30: Line 30:
and you will receive a listing of its contents, as would anyone on the internet.
and you will receive a listing of its contents, as would anyone on the internet.


You may not find this a desirable response. This page shows you how to prevent this listing.
This may not be a desirable response. The following shows you how to prevent this listing.


== htaccess commands ==
== .htaccess commands ==
There is only a single command to learn:
There is only a single command to learn:


Line 75: Line 75:
Again this is a text file that uses any regular HTML tag, for example:
Again this is a text file that uses any regular HTML tag, for example:


'''<nowiki><h1>More Power of htaccess</h1>'''</nowiki><br>
'''<nowiki><h1>More Power of .htaccess</h1>'''</nowiki><br>
'''<nowiki><p>Why the name README and not FOOTER, I have no idea</p></nowiki>'''
'''<nowiki><p>Why the name README and not FOOTER, I have no idea</p></nowiki>'''