I do not want index.html to be the default page when a person
accesses my site. If I rename index.html to index.shtml, all I get is
a directory listing.
The DirectoryIndex directive allows you to specify a specific
filename or filenames as the default page in a directory. Depending on
your needs, you can even make a CGI script the default. One note of
caution on using a CGI as your default page: Many search engines will
not index it.
If you have permission to edit the master configuration files
Edit the files
httpd.conf and
srm.conf file
and do the following:
Find this line.
DirectoryIndex index.html
and change it as follows:
DirectoryIndex index.shtml index.html
Of course, you can use any filename you wish. I prefer to leave
index.html as a valid index as well.
Changing The Default Page using
.htaccess
If you are unable to edit your master configuration files, you
can use this directive from .htaccess.
Just edit the .htaccess file
located in your main HTML directory. If you do not have this file,
feel free to create it!
To change the default page, either edit the existing DirectoryIndex
line or add the following:
DirectoryIndex index.shtml index.html
This will make index.shtml the default page.
By using a .htaccess file in a subdirectory,
you can specify a different default page for that one directory without
affecting the rest of your site.