The index of a directory can come from one of two sources:
- A file written by the user, typically called
DirectoryIndexdirective sets the name of this file. This is controlled by
- Otherwise, a listing generated by the server. This is provided by
Method 1:- Edit the httpd.conf file
This method can only be done by Server administrator.
This method is suited for someone who uses a dedicated server/VPS. Open the httpd.conf file using a text editor and search for the following line.
DirectoryIndex index.html index.htm index.php
Add the file names at the end of the second line with a space. Take a look at the following example
.COM only $8.99|
.com $8.99, .info $4.99, .org $9.99, .net $10.99, .co $9.99
Unlimited Cpanel Website Hosting From $3.33/mo
Managed WordPress Hosting From $5.59/m
VPS from $29/m
Dedicated Server from $129/m
QuickShopping Cart from $9.99/m
More information : Cpanel.Powerhoster.com
DirectoryIndex index.html index.htm index.php home.html myname.php jesin.htm
In this way you add all the desired file names. Finally save the file and restart Apache Server. If it refuses to start then check for syntax errors.
Method 2:- Create/Edit .htaccess File
This method is for the most of us who host our websites on a shared server. .htaccess file in your public_html folder.
DirectoryIndex newfile.html index.cgi index.php
The above lines tell the Apache Web Server to display the ‘newfile.html’ file as the directoryindex, if this file is not available then display ‘index.cgi’, and if this is not available then display ‘index.php’.
Test your new configuration by placing a file of the name specified in the DirectoryIndex list.