Main Tutorials

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.

About Author

author image
Founder of Mkyong.com, love Java and open source stuff. Follow him on Twitter. If you like my tutorials, consider make a donation to these charities.

Comments

Subscribe
Notify of
9 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Henry Stanley
2 years ago

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

Kavya Mellacheruvu
3 years ago

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

PAECH
11 years ago

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?

PAECH
11 years ago
Reply to  PAECH

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

Robert
10 years ago
Reply to  PAECH

Thanks for the sollition, its works on Ubuntu 12.04.

kkhinehtoo
14 years ago

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

Rejin
14 years ago

Thanks a lot.. its working fine..

Patelmohsin
15 years ago

thank you very much …..!!!!!!

HA …HA…HA…Its working

Thank you MKYou Again from true heart ..

MAY The God bless You