Showing posts with label Web. Show all posts
Showing posts with label Web. Show all posts

Sunday, January 13, 2008

Folder Listing in Apache

Default configuration value for folder listing in recent Apache servers seems to change. Now, by default, we cannot list folder contents without an index file. To allow folder listing without an index file, we need to set an option properly. If we start from a fresh installation of Apache 2.2, the default option is

Options FollowSymLinks

We can change it to

Options Indexes FollowSymLinks

And, directory listing will work just fine. Note: 'Deny from all' directive may still prevent us from viewing a page. We can delete or comment out the directive to view contents.

To make folder listing looks better, we should also employ fancy style by uncomment the second following line:
# Fancy directory listings
#Include conf/extra/httpd-autoindex.conf

Please consult http://httpd.apache.org/docs/1.3/mod/core.html#options for details.

Monday, November 26, 2007

Server-Side Include in Apache

(Nov 26, 2007)

I tried using server-side include (SSI) feature in Apache 2.2.6. I followed all steps in its documents. These are:
1. use Options +Include in
2. use AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
within mime_module (just uncomment these two lines in httpd.conf)
3. use an include element, such as

However, it turned out that my stuff did not work. I spent about two hours to figure this out. Finally, I knew that .shtml did not mean a file to be included., but .shtml meant a file that included other files. Namely, I just renamed a 'master' file, menu.html, to menu.shtml, and every thing worked fine.

Moreover, a file to be included can be .html, no need to make it .shtml.

Note: although it is possible that we can allow .html to be a master file in the same way by adding AddOutputFilter INCLUDES .html, I will not do this since 3rd party server may not allow us to do this (I think it might slow down the web server).