Sunday, May 1, 2011

How to make an apache home directory browsable?

I was looking for my apache's home directory to be browsable but somehow it was not showing
directory listing. Well, apache has an option call "Options" which should be set to "Options -Indexes" sometimes which prevents directory browing if there is "no index.html" file in that directory.

IN my case, I was experimenting it on a centos system and found that in following location, it needed to be modified:

# cat /etc/httpd/conf.d/welcome.conf
#
# This configuration file enables the default "Welcome"
# page if there is no default index page present for
# the root URL. To disable the Welcome page, comment
# out all the lines below.
#
< LocationMatch "^/+$">
Options -Indexes
ErrorDocument 403 /error/noindex.html
< /LocationMatch>


So, the moment I changed the "-Indexes" to "Indexes" and restarted httpd, voila!!! it started working as expected.... i.e. I just enabled directory browsing!!! :)


# cat /etc/httpd/conf.d/welcome.conf
#
# This configuration file enables the default "Welcome"
# page if there is no default index page present for
# the root URL. To disable the Welcome page, comment
# out all the lines below.
#
< LocationMatch "^/+$">
Options Indexes
ErrorDocument 403 /error/noindex.html
< /LocationMatch>

No comments: