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.

1 Answer 1


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: http://httpd.apache.org/docs/2.0/mod/mod_dir.html

  • 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, 2010 at 4:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy