Saturday, October 9, 2010

Apache2 - DirectoryIndex

Setting the DirectoryIndex for Apache2 in Linux can be done editing the following configuration file.

nano /etc/apache2/sites-available/default

Look for the following block of text and add the DirectoryIndex line shown in blue.

<Directory /var/www/>
  Options Indexes FollowSymLinks MultiViews
  AllowOverride None
  Order allow,deny
  allow from all
  DirectoryIndex index.php index.html index.htm

The file names are in order of priority. So in this example, index.php will be shown before index.html if both files exists in the same directory for the website.

Note: I am using nano, you may also use vi depending on your preference and Linux distro.
Anonymous said...

s/Linux/debian-based distros that are using the default configuration/

Post a Comment