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 the Author

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

Comments

Leave a Reply

avatar
newest oldest most voted
PAECH
Guest
PAECH

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
Guest
PAECH

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

Robert
Guest
Robert

Thanks for the sollition, its works on Ubuntu 12.04.

kkhinehtoo
Guest
kkhinehtoo

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

Rejin
Guest
Rejin

Thanks a lot.. its working fine..

Patelmohsin
Guest
Patelmohsin

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

HA …HA…HA…Its working

Thank you MKYou Again from true heart ..

MAY The God bless You

trackback
Perl Coding School » Blog Archive » perl tutorial [2008-09-24 18:57:38]

[…] How to set / change default page in Apache By mkyong Install Perl in PostgreSQL, The specified module could not be found. Regular Expression in PostgreSQL; d3dx9_34.dll missing , not found (solution); Html Font Tutorial; Javascript Highlight search result; Convert Subquery Result to Array … Programmer Life – http://www.mkyong.com/ […]