How to set / change default page in Apache

Here i will show how to set or change default page in Apache. Apache default page is very easy to configure, we just need to configure Apache conf file in following location

Apache file path/conf/httpd.conf

Make the following changes in httpd.conf file. Change index.html or index.php to whatever default page you want.


#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
<IfModule dir_module>
    DirectoryIndex index.html index.php
</IfModule>

Restart Apache ~ Done.

9 comments on “How to set / change default page in Apache

  1. Hi I’m very new this and can’t figure out what the apache path name is please help! Thank you

    Reply
  2. Hi Mykong,
    I am getting Apache2 Debian Default page in Windows OS. Could you please help on how to get rid of this issue. PS: I am a beginner

    Reply
  3. Hi mkyong, I surely did something wrong.
    Using Ubuntu 12.04 + LAMP (fresh install), I try to point to /var/www/Leclerc/index.php
    I still stuck with apache2’s default page (/var/www/index.html) that displays “It works!” (I did restart, of course)

    None of these lines works:
    DirectoryIndex Leclerc/index.php
    DirectoryIndex www/Leclerc/index.php
    DirectoryIndex /var/www/Leclerc/index.php

    I see that apache2.conf correctly includes httpd.conf

    What the matter in my Apache?

    Reply
    1. I share my answer:
      Set “DirectoryIndex Leclerc/index.php” to apache2.conf and leave httpd.conf alone.

      Reply
      1. Thanks for the sollition, its works on Ubuntu 12.04.

        Reply
  4. Yes it work ! .. That’s nice . Thank u very much …

    Reply
  5. thank you very much …..!!!!!!

    HA …HA…HA…Its working

    Thank you MKYou Again from true heart ..

    MAY The God bless You

    Reply

Leave a Comment

Your email address will not be published. Required fields are marked *