You've probably seen that when the user requests a directory not a filename they are sent the index.html or the index.htm file if it exists, if not they typically get either a 403 Forbidden page or more likely a server generated index page.
If you want to change that (perhaps you've developed offline and forgotten to use that convention and named your main page something like home.htm) you can use our old friend the .htaccess file.
Check your host is happy for you to play around with .htaccess files before continuing. What follows applies only to Apache.
Open Notepad and type this line:
Code:
and save it as htaccess.txt. Upload it to the directory concerned and rename it to .htaccess - the . is vital and makes the file invisible.
Now point your browser to the directory, if you get the home.htm page it's worked, if not clear your cache and try again. Still no luck then the SysAdmin's probably set the server up so that you don't have this facility.
The list of filenames after DirectoryIndex are used in order. If a directory contains an index.htm, an index.html and a home.htm, the index.html file will be used because it appears first in the DirectoryIndex directive.
Note that the .htaccess file will also accept subdirectories of the directory it's placed in.
If you need to remove the file and you can't see it, just upload a blank file over it with the same name.
This tip is particularly if you want to use files like index.php3 or index.shtmlrn
