Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 05-30-2014, 12:22 AM   #1
LQ Newbie
Registered: May 2014
Distribution: CentOS 6.x
Posts: 7

Rep: Reputation: Disabled
Disable directory but not file listings in httpd.conf

I have apache running on a file server. One particular directory stores complete webpages saved from a browser. Thus there are .html, .htm, .php type files with corresponding directory names. For example, a webpage article saved to the directory has a file named, "Open Source Software Review.htm", and there is a corresponding "Open Source Software Review" directory containing all of the image files, etc. Clicking on the .html, .htm, and .php files brings up the complete webpage. However, it is not necessary to see the corresponding directories, only the file names.

I've been trying to figure out a directive that would allow only the listing of files, and not the corresponding directories. I've looked through the documentation and have tried various directives without success. Is there any way to do this or perhaps to only see certain file types and not directories or other file types? Any help would be greatly appreciated. Thanks.
Old 05-30-2014, 03:22 AM   #2
LQ Guru
Registered: Jun 2004
Location: Piraeus
Distribution: Slackware
Posts: 13,175
Blog Entries: 1

Rep: Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042Reputation: 2042

I'm afraid that your only option is to use the IndexIgnore directive with all the directories you want to hide
IndexIgnore "Open Source Software Review" "Some Other Directory" "Another Directory"
Old 05-31-2014, 04:40 AM   #3
LQ Newbie
Registered: May 2014
Distribution: CentOS 6.x
Posts: 7

Original Poster
Rep: Reputation: Disabled
Unfortunately that won't work out for what I'm trying to do. I don't want to be editing the httpd.conf file every time a user adds a webpage to the directory, just to clean up the appearance of the listing. I know there isn't any directive that would allow me to do what I'm trying to accomplish directly. I was hoping there might be some creative solution. I noticed several directives that allow for regular expressions for example. I suppose if I really wanted to solve the problem with the IndexIgnore that I could write a short script to run a directory listing and parse the results into the httpd.conf using the IndexIgnore directive on some sort of a 5 minute cron job, but I really hate solutions so overthought.

Well in the big picture, this isn't that big a deal. It really is just a cosmetic problem in the first place. I just thought I'd throw it out there on the hopes that someone had already run across this and had a ready solution. I do appreciate your reply Bathory even if it wasn't what I am looking for.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to configure /etc/httpd/conf/httpd.conf file to run a html on web arunava.saha Red Hat 2 05-30-2012 03:28 AM
httpd - directory listings cjagdish69 Linux - Server 4 10-17-2008 02:00 AM
Starting httpd: httpd: Syntax error on line 209 of /etc/httpd/conf/httpd.conf: Syntax sethukpathi Linux - Networking 6 04-12-2008 11:26 AM
Disable httpd.conf server os token Swakoo Linux - General 7 01-24-2007 11:38 PM
Directory/File Listings AndeAnderson Debian 7 02-24-2005 12:59 AM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:05 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration