How to list all text files in a directory?

Why is Apache not listing any files in an open directory?

  • I've been helping my friend setup his personal website and we have been muddling through with plenty of help from google and a little bit of luck.But recently, I've been stumped by a persistent problem with a directory containing some files. Here's the scenario - my friend shares his RSS reading list as an OPML file. In addition, he wants to try and show how his reading list has evolved by archiving older versions of his reading list in a folder. He also wants to allow other people to browse this archive folder.It seemed like we should be able to achieve this using .htaccess files, but unfortunately it's not working like we expected. The .htaccess file that we came up with is as follows:Options +Indexes +MultiViews +FollowSymlinks IndexOptions FancyIndexing order allow,deny allow from all The directory can be viewed http://linkblog.balaji-dutt.name/resources/opml_archive/. At first I thought it might be a problem with file permissions, so I tried CHMOD'ing all files to 777 but the folder remains empty. Next, I tried to see if any file was getting displayed and uploaded a text file and a jpeg to the directory and found that nothing changes. So it isn't a problem with unrecognized file types, nothing is getting picked up! In the root folder of the linkblog, there is a htaccess file that has the following entry:# BEGIN Prevent Directory Listing IndexIgnore * # END Prevent Directory Listing I tried to force an override by including an Override Indexes command as follows:< Directory "/home/content/linkblog/resources/opml_archive" > AllowOverride Indexes That only resulted in a "500 Internal Server Error". Additional info: The server is hosted at GoDaddy. If the question seems long and rambly, apologies - this is my first question to AskMeFi and I figured it's better to go overboard with the data points :)

  • Answer:

    To be clear, removing IndexIgnore should fix the problem. If you want to not list indexes in other directories, you should replace "IndexIgnore *" with "Options -Indexes". This should cause "Options +Indexes" to work on subdirectories (this should be put in an .htaccess file in opml_archive). I haven't tested any of this.

your mildly obsessive average geek at Ask.Metafilter.Com Visit the source

Was this solution helpful to you?

Other answers

Did you chmod the parent directory as well?

null terminated

Actually, "IndexIgnore *" is almost definitely doing this. I would first comment this out to make sure this is causing the problem. If IndexIgnore is necessary, I would create an .htaccess file in opml_archive containing "Indexignore .htaccess". However, I don't know if this overrides previous settings or just adds ".htaccess" to the ignore list.

null terminated

: " The "Options -Indexes" change fixed it! I can now see files in the opml_archive directory while the parent directory still returns a 403 error (I had the IndexIgnore on because it was a "recommended" security practice for Wordpress blogs). Thank you so much!

your mildly obsessive average geek

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.