Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My test server will happily serve PHP pages if I navigate to them.

However, on one vhost, I have an index.php. This page will be served if I type in the URL. But, if I just type in 'http://mysite/', then the index.php will not be served.

I am running Apache 2.2 with the PHP module on Ubuntu.

share|improve this question
up vote 3 down vote accepted

You'll need to set the DirectoryIndex directive in your apache config.

Something like

DirectoryIndex index.php index.html index.htm

It can appear in either your server config, virtual host, directory, or an .htaccess file.

For full info:

share|improve this answer
Thanks Andrew. That did the trick. I placed that line near the top of the config file for my virtual host, and then restarted apache. Now the index.php page is visible straight away. – robert Feb 15 '10 at 4:49

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.