This is a discussion on Apache2; mod_autoindex, HeaderName & DocumentRoot. within the Linux Web Servers forums, part of the Web Server and Related Forums category; I'm having a problem or two with Apache 2 & the header I wish to include for my auto-...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I'm having a problem or two with Apache 2 & the header I wish to
include for my auto-indexed directories. I can't seem to work it out, and am hoping someone can help me. I have a number of virtual hosts, and I want each one of them to include the same header for their directory index - for instance if I wanted both user1.stroller.uk.eu.org & user2.stroller.uk.eu.org to have a link to a banner ad at the top of all of their pages, including user1.stroller.uk.eu.org/foo/ & user2.stroller.uk.eu.org/bar/ So in /etc/apache2/conf/commonapache2.conf I have sections that look something like this: <IfModule mod_alias.c> Alias /icons/ /home/httpd/icons/ Alias /markup/ /home/httpd/markup/ Alias /doc /usr/share/doc </IfModule> # End of Alias directives. <IfModule mod_autoindex.c> # FancyIndexing is whether you want fancy directory indexing or standard IndexOptions FancyIndexing VersionSort NameWidth=* SuppressHTMLPreamble # AddIcon* directives tell the server which icon to show for different # files or filename extensions... AddIconByEncoding (CMP,/icons/compressed.png) x-compress x-gzip AddIconByType (TXT,/icons/text.png) text/* .... # DefaultIcon is which icon to show for files which do not have an icon DefaultIcon /icons/unknown.gif # ReadmeName is the name of the README file the server will look for by # default, and append to directory listings. # HeaderName is the name of a file which should be prepended to # directory indexes. # # ReadmeName README.html HeaderName /HEADER.shtml # ReadmeName FOOTER.html ReadmeName /FOOTER.html # IndexIgnore is a set of filenames which directory indexing should ignore # and not include in the listing. Shell-style wildcarding is permitted. IndexIgnore .??* *~ *# HEADER* FOOTER* RCS CVS *,v *,t </IfModule> # End of indexing directives. Note that the mod_include documentation <http://tinyurl.com/rfyr> says: "Both HeaderName and ReadmeName now treat Filename as a URI path relative to the one used to access the directory being indexed. If Filename begins with a slash, it will be taken to be relative to the DocumentRoot." $ grep -i DocumentRoot /etc/apache2/conf/apache2.conf DocumentRoot /home/httpd/htdocs But if I stick the HEADER.shtml in that directory and browse to http://user1.stroller.uk.eu.org the contents of that header are not shown before the file listing. "Ah!", you say, "but that's a virtual host yada yada yada", and true, when I move HEADER.shtml to /home/httpd/htdocs/user1.stroller.uk.eu.org/ it is displayed correctly. But right now, it's contents are only: <!--#echo var="DOCUMENT_ROOT" --> and it's output is "/home/httpd/htdocs/" So I'm right confused. You can see that I've also got: Alias /markup/ /home/httpd/markup/ in my configuration, but sticking the HEADER.shtml in there gives no joy, either. Is there any way I can put this file in such a place that all virtual domains & all their subdirectories will reference it..? Right now it seems that I can put a sym-link in the highest of each of the virtuals' directories, and it works fine, but I'd prefer not to have to, in case I forget sometime when I'm adding one. Many thanks in advance for any suggestions, Stroller. |