Disabling Directory Listings


<Directory /usr/local/apache2/htdocs/private>     Options -Indexes </Directory>


Apache allows you to define special index files with the DirectoryIndex directive. When a request is made by a client that maps into a directory path, Apache looks for one of those index files (usually named index.html or home.html) and returns it to the browser. Alternatively, if no such file is found, Apache will return an HTML page containing a listing of the directory. While this is useful during development, or when making available a file repository, it can also provide the names of files that you do not want published or indexed by search engines (such as backup files). You can disable directory listings by disabling the mod_autoindex module or using the Options directive as shown here.

If per-directory configuration files are enabled, you can also place the example in an .htaccess file.




Apache(c) Phrase Book(c) Essential Code and Commands
Apache Phrasebook
ISBN: 0672328364
EAN: 2147483647
Year: 2006
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net