≡ Menu

Apache Display / Change a Default Page Other Than index.html

How do I display or change a default page other than index.html or index.php under Apache web server?

You need to use DirectoryIndex directive under Apache to set a default page other than index.html or index.php.

The DirectoryIndex directive sets the list of resources or file to look for, when the client requests an index of the directory by specifying a / at the end of a directory name.

Edit httpd.conf

Open your Apache configuration file httpd.conf
# vi httpd.conf

Find out line that read as follows:

Now set it as per your requirements:
DirectoryIndex index.html index.htm default.htm index.php index.pl

Save and close the file. Reply Link

  • Naseem December 8, 2008, 1:21 pm

    Thank u very much… I had same problem with drupal but solved now , and I can view all pages of Drupal.

  • Uday January 13, 2009, 5:31 am

    Thank you very much.

  • takaru May 28, 2009, 4:28 am

    thanks for the guide

  • MrKIPS July 22, 2009, 3:11 pm

    Hi, although apache manuals contain this information, your website gives solutions for commonly sought after problems/questions. Useful indeed! Thank you.

  • nikhil September 16, 2009, 1:40 pm

    What do you to if you wanted to change your default desktop?

    A.Use the switchdesk program.
    B.Edit /etc/X11/prefdm.
    C.Open the .Xdefaults file in your home directory.
    D.Link startx to gnome-session or startkde.

  • Drew October 27, 2009, 5:18 pm

    Just a note, you don’t have to restart the server to make these changes you can use the reload command

    /etc/init.d/apache2 reload

  • Amera December 29, 2009, 8:59 pm

    Thank you very much.
    I had problem of setting my home page too.

  • soluicius October 26, 2010, 6:59 pm

    yeah i have done that .. but now my apache list the script that in my index.php is :|…

  • Sumaroo Suyash Kumar May 4, 2011, 12:43 pm


    nice little article…works nicely

  • praveen July 4, 2011, 9:34 am

    how I can make all my php pages extenions(.php) should be shown as html extension(.html). Is there any way I can change that to .php files to .html when client acces the php pages? Please resolve the issue as soon as possible. Thanks!

  • Mohsin September 18, 2012, 7:02 pm

    Thanks Alot:)
    I really appreciate!

  • JK April 10, 2013, 5:58 am

    Thanks for the information. It really helps a lot.

  • Mrudula April 10, 2013, 11:55 am

    Wooooohhooooo…!!! It worked.. :)

  • lalitha November 20, 2013, 6:12 am

    how can i make this work if im hosting two webpages? using VirtualHost

  • Gunasekhar January 24, 2014, 10:31 am

    Thank u sir

  • luniga March 1, 2014, 6:14 am

    Thanks… it works

  • Security: Are you a robot or human?

    Leave a Comment

    You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

       Tagged with: , , , , , , , , , , ,