Change The Default Index Files!

Change Default Index Files

Most web-domains setup your account to use a specific file extension as default and in most causes it's to protect the users web-directory from being exposed.

So by default they us the index.html file. In most cases they have set a default to use the following extensions index.html, index.htm, default.html or even index.HTML Code
, but what happens if you don't want to use any of those names for your index file?

What if you want your index file to be called yoursitename.html (for example).

Well we can use .htaccess to help with this problem.

We can use the DirectoryIndex command in the .htaccess file and then create a list of the index files we will be using throughout the site. The server will work from left to right, checking to see if each file exists; if none do exists it will display a directory listing (unless, of course, you have turned this off).

The code for this will something look like this:

Quote:
DirectoryIndex yoursitename.html yourindex.html myforum.html


By setting the DirectoryIndex command in the .htaccess file you're telling the Apache server to use your default settings! For your root directory file extensions!
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

be on the lookout for these common grammatical slip-ups

Takeaway: Sending a less-than-perfect e-mail to a friend is one thing; mistakes aren't really a...

Font Basics for Branding Your Small Business

There are many components of a brand identity: logo, color palette, font choice, and the Visual...

Website traffic statistics

Question:I was hoping to find out how many hits the website gets. How do I go about checking the...

How to install and use WS_FTP to move files to and from a website

What is It WS_FTP is a program that allows you to transfer files from your computer to another...