Computer Help Community

Community

Cyber Tech Help Community

New Tutorials

PC Tutorials

New Downloads

More Downloads
PC Downloads

Member Testimonials

Open Member Quote   I just want to say that in the long time I have been a member here, the service has been great, and the members the same, and that CTH has grown into the community that we all know and love - Oracle  Close Member Quote
Member Testimonials
MY CYBER TECH HELP

LATEST TOPICS

Tech Help Community

Free Antivirus Scan

Free Virus Scan and a listing of the top 10 viruses in the wild - Free Antivirus Scan
Free Online Antivirus Scan

File Extension Database

Find what program a filetype belongs to in our searchable File Extension Database.
File Extension Database

Related Microsoft Links

Services
Cyber Tech Help Community

To the top of the page to top

 



Tutorials | The index effect

Publish date: 19:02 Thursday, 28th July 2005
Written by: Steven Bentley
Audience intended for: Web Designers
Category: Web Design

Go up a levelGo up a level

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:


DirectoryIndex index.html index.htm home.htm

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

 

Please Note: if you have any questions about this tutorial please ask on our support forums
If you have written a tutorial of your own and would like to have it here on Cyber Tech Help all you have to do is Submit your tutorial and it will be reviewed by the Administrator.