How to change the default index page using a .htaccess file

The below command will set the default page your website shows to whatever you specify. For example the below command will set your website to show the index.html file as default.

DirectoryIndex index.html

The below change will attempt to show business.html as the default page for your website and every directory.

DirectoryIndex business.html

And you can even do something cool like have it load a movie or image by default.

DirectoryIndex cool.mov

Or even specify multiple files so that it will try to load the first one, then the next, and so on. So with the below line it would try to load business.html, then if that wasn’t there index.cgi, and if that wasn’t there index.pl, and so on.

DirectoryIndex business.html index.cgi index.pl default.htm

If it can’t find the file you specify it will revert to a directory listing of the files in that folder.

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

530 Relaying not allowed in a Email Clients

This error occurs when a user or mail client attempts to send email without authenticating on the...

How to do a Telnet

Telnet is used to test open ports or administer remote servers via the command prompt.The telnet...

How to do a Tracert

A traceroute is a function which traces the path from one network to another. It allows us to...

How to do a Ping

Ping is a command used to test whether a host is reachable via your internet connection. The...

Error Page Codes

These are probably the most common error codes that a visitor might see, you may like to create...