StandardNerd
StandardNerd

Reputation: 4183

htaccess hide "Index of"

I want display just the directory content of my Webserver.

My .htaccess file contains:

Options '+Indexes'
IndexOptions +FancyIndexing

And in the browser I got the path :

"Index of /~efc/"

In the footer :

"Apache/2.2.22 (FreeBSD) mod_ssl/2.2.22 OpenSSL/1.0.1c mod_hcgi/0.9.4 DAV/2 Server"

Is there a way to prevent these lines?

EDIT: In addition to the answer of Sàt i got my desired result with following directives:

Options '+Indexes'

# SET INDEX OPTIONS
IndexOptions IgnoreCase FancyIndexing FoldersFirst NameWidth=* DescriptionWidth=* SuppressHTMLPreamble

# SPECIFY HEADER FILE
HeaderName header.html

# SPECIFY FOOTER FILE
ReadmeName footer.html

# IGNORE THESE FILES
IndexIgnore header.html footer.html

Upvotes: 2

Views: 3080

Answers (2)

f_puras
f_puras

Reputation: 2504

The footer is also printed on error pages like 404. You can control its display via the ServerTokens directive in your httpd.conf.

Upvotes: 0

SáT
SáT

Reputation: 3692

Sure. Use the HeaderName and ReaderName directives, like this:

Options '+Indexes'
IndexOptions +FancyIndexing
HeaderName fancy_hdr.html
ReadmeName fancy_readme.html

HeaderName points at the html file rendered before the listing, ReadmeName points at the html rendered after the listing.

There are a whole lot of fun customization options, you might want to take a look at those in the docs or various tutorials.

Upvotes: 2

Related Questions