Welcome to WebmasterWorld Guest from 54.163.209.109

Forum Moderators: Ocean10000 & incrediBILL & phranque

getting my README.txt to display in directory list?

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

Junior Member

Top Contributors Of The Month

joined:Sept 13, 2013
posts: 189
votes: 1


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?
12:02 am on Nov 16, 2017 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14315
votes: 560


:: 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)?
1:23 am on Nov 16, 2017 (gmt 0)

Junior Member

Top Contributors Of The Month

joined:Sept 13, 2013
posts: 189
votes: 1


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"?
4:18 am on Nov 16, 2017 (gmt 0)

Administrator

WebmasterWorld Administrator phranque is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:Aug 10, 2004
posts:11114
votes: 110


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.
4:39 am on Nov 16, 2017 (gmt 0)

Senior Member from US 

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time 5+ Year Member Top Contributors Of The Month

joined:Apr 9, 2011
posts:14315
votes: 560


:: 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.)
12:45 pm on Nov 16, 2017 (gmt 0)

Junior Member

Top Contributors Of The Month

joined:Sept 13, 2013
posts: 189
votes: 1


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.
12:54 pm on Nov 16, 2017 (gmt 0)

Junior Member

Top Contributors Of The Month

joined:Sept 13, 2013
posts: 189
votes: 1


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
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members