Forum Moderators: phranque

Message Too Old, No Replies

getting my README.txt to display in directory list?

         

Dan99

9:40 pm on Nov 15, 2017 (gmt 0)

10+ Year Member Top Contributors Of The Month



OK, I'm moving a site from a stand-alone server to a commercial shared server. On my stand-alone Apache server, when I put a README.txt in a directory, and then list that directory to a client, the README.txt is written out, headlined below the directory list. As in, here's the directory above, and here are some things you should know about it.

But, my commercial server (HostGator) seems to default to IndexIgnore my README.txt. That README.txt is not headlined, but is just listed innocuously along with all the other files in the directory. Ugh. Other than that, it works well.

Now, in my stand-alone system, no sweat. That's about removing README.txt from my IndexIgnore in my httpd.conf file. But, but, my commercial server doesn't offer me an httpd.conf file! In fact, the somewhat clueless support folks don't even really know what an httpdconf file is!

So my question is, what are my options to restoring my original functionality for README.txt? Can I do something with my .htaccess?

lucy24

12:02 am on Nov 16, 2017 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



:: quick detour to Apache docs ::

The IndexIgnore directive can be used anywhere, including htaccess. But are you sure you meant IndexIgnore and not IndexOptions (which can also be used in htaccess)?

Dan99

1:23 am on Nov 16, 2017 (gmt 0)

10+ Year Member Top Contributors Of The Month



I was under the impression that you had to remove README.txt from IndexIgnore to allow it to be written out, and not just listed as a file. But you tell me. What should I do? If there is an IndexIgnore README.txt somewhere in an httpd.conf file that I can't access, can I undo that in my own .htaccess? How do I say "no, do not ignore after all"?

phranque

4:18 am on Nov 16, 2017 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



i would carefully study all the mod_autoindex directives:
https://httpd.apache.org/docs/current/mod/mod_autoindex.html [httpd.apache.org]

some combination of IndexIgnoreReset, IndexIgnore, and ReadmeName should do the trick.


in the worst case scenario, you could create an directory index document script for each directory as required (e.g. index.php or index.cgi) and use that script to read the directory and display it as you wish.

lucy24

4:39 am on Nov 16, 2017 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



:: rechecking docs ::

D'oh! The directive we want is actually CALLED ReadmeName ;) It seems to work the same in 2.2 and 2.4, and both versions cross-reference you to HeaderName in the same module. (Header goes at the top; Readme-if-any at the bottom.)

Dan99

12:45 pm on Nov 16, 2017 (gmt 0)

10+ Year Member Top Contributors Of The Month



Yes! That works. I just put "ReadmeName README.txt" in my .htaccess, and README.txt is opened and presented when one requests a listing of a directory that has that that file in it. Thank you!

But, somewhat oddly, compared to my former implementation, the filename README.txt is still listed in the directory along with everything else. In my old implementation it wasn't. Would be nice if it weren't listed there, since it's whole purpose in life is just to be presented at the bottom of the directory listing. Not clear that ReadmeName has any options that would prevent it being listed.

Dan99

12:54 pm on Nov 16, 2017 (gmt 0)

10+ Year Member Top Contributors Of The Month



OK, that was easy. I just do "IndexIgnore README.txt" in my .htaccess, and that file disappears from the index. Yay!
My previous implementation must have had those two lines in httpd.conf.

Many thanks for the prompt and accurate advice