Apache display or change a default page other than index.html
Q. How do I display or change a default page other than index.html or index.php under Apache web server?
A. 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.
Open your Apache configuration file httpd.conf
# vi httpd.conf
Find out line that read as follows:
DirectoryIndex
Now set it as per your requirements:
DirectoryIndex index.html index.htm default.htm index.php index.pl
Save and close the file. Restart the Apache webs server:
# /etc/init.d/httpd restart
Please note that if you don’t have access to Apache configuration file. Add DirectoryIndex to .htaccess file.
You can also specify php or pl dynamic script. Also note that the documents do not need to be relative to the directory. Consider following example
DirectoryIndex index.html index.pl /nav/index.php
Above would cause the php script /nav/index.php to be executed if neither index.html or index.pl existed in a directory.
Subscribe to our free e-mail newsletter or RSS feed to get all updates.
You can Email this page to a friend.
Related Other Helpful FAQs:
- Apache 403 Forbidden Error and Solution
- Apache Log Files
- Fedora / CentOS / RHEL Linux change default desktop or display manager
- Why my Apache Server Side Include (SSI) is not working?
- Run shell script from web page
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!


Recent Comments
Today ~ 3 Comments
Today ~ 57 Comments
Yesterday ~ 9 Comments
Yesterday ~ 7 Comments
Yesterday ~ 1 Comment