Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modifying the indexing page

Status
Not open for further replies.

coleProtocol

Programmer
Jun 10, 2005
4
US
Hello, I'm fairly new to Apache, and I would like to know how to modify the page that displays the files/folders in a folder if there's no "index.*" page (or whatever is set to view first in a directory). Thanks for any help.
 
coleProtocol,

You'll need to modify the DirectoryIndex directive in the main httpd.conf (to modify all directory indices) or in a VirtualHost container (to modify a single direcory index).

Take a look at
(for Apache 1.x) or
(for Apache 2.x).

Wishdiak
A+, Network+, Security+, MCSA: Security 2003
 
Thank you, and maybe I'm reading your post wrong, but what I was looking for was what the server displays if there isn't a DirectoryIndex. Take this page for example: I want to do what it does in the way that the page that Apache displays when there's no directory index can have other stuff on it.

I looked around the first link you gave me, and found some other pages that explained about this, and I even found a way to insert a file into that page ( but I don't know where to put the command to insert that file. It said it was in a module called mod_autoindex, but the only files that had "mod_autoindex" in them were files in the manual folder, which were exactly what I was looking at online.

Than you again for your help.
 
coleProtocol,

If I understand your last post correctly, you want to be able to display both some text and a directory list when there isn't an index.htm[l] file in the directory?

If so, you can specify the HeaderName directive, either in your main httpd.conf, in a VirutalHost container, or in a .htaccess file. As long as you have Options Multiviews set, you'll get the sort of display that's on (text and a directory listing).

Wishdiak
A+, Network+, Security+, MCSA: Security 2003
 
Thank you, this is what I was looking for. But where do I put the "HEADER.html" file? I've tried the Apache install directory, and the web root, but neither worked. Thanks.
 
coleProtocol,

The filename that you specify with HeaderName is either in the DocumentRoot (HeaderName filename) or relative to the DocumentRoot (HeaderName /relative/path/to/filename).

You can also append text to the end of the directory listing with the ReadmeName directive, in which case you'd specify a filename the same way.

Wishdiak
A+, Network+, Security+, MCSA: Security 2003
 
It's not working for me. In the httpd.conf file, the HeaderName line is set to HEADER.html, and I have a file named HEADER.html in the DocumentRoot (which works fine when calling other files). The HEADER.html file just has some simple HTML in it, including the standard starting tags of a file (HTML,HEAD,TITLE,BODY), and the words Testing Header in it. When that didn't work, I just tried taking out all the HTML and leaving Testing Header there, but it still didn't work.

There's no files that match any of the names specified in DirectoryIndex in that folder, I'm not using the file:// thing before my URL; it's using localhost. All the files work fine, and I really have no clue why this isn't working for me...
 
coleProtocol,

What content do you see when you browse to I hate to ask an obvious question, but did you restart Apache recently?

Also, did you read
If the file specified by HeaderName contains the beginnings of an HTML document (<HTML>, <HEAD>, etc) then you will probably want to set
IndexOptions +SuppressHTMLPreamble, so that these tags are not repeated.

Wishdiak
A+, Network+, Security+, MCSA: Security 2003
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top