loader

Change The Default Index Files! Print

  • 1

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!

Kas see vastus oli kasulik?

« Tagasi