How do I make tell apache to make an index file for a folder ?
How to make file to serve by default on calling a folder ?
How do I make index.htm file to serve automatically when I call a directory ?

8 July 2004, 07:19 am IST
User Rating: 6.2 (20 votes)

You need to tell apache which files are to be served when a directory or domain is requested. To do so, edit apache's httpd.conf file and add or modify the following line:

DirectoryIndex index.phtml index.php index.php3 index.shtml index.html index.htm

You can specify multiple entries. The order of preference is from right to left. That is index.phtml would be served if it exists, then apache will look for index.php and so on ...

So, if you request a url http://localhost/folder1/ and there exists a file index.htm in folder1, then it would be served on this request.

If you have multiple virtual hosts on the server, make sure you add this line into proper <VirtualHost ... > entry.

Rate this knowledge base item


  • 1
    Poor

  • 2

  • 3

  • 4

  • 5

  • 6

  • 7

  • 8

  • 9

  • 10
    Great
 
blog comments powered by Disqus

Topics

About

Amit Arora is web developer with expertise in developing eCommerce enabled websites for the businesses.

Contact | Resume

Subscribe to newsletter




Get Firefox

Monitored by Site24x7
Uptime