K.K. Smith
K.K. Smith

Reputation: 992

Not finding index pages?

Ok.. total noob question.

I always thought that when I saw a URL like www.siteName.com/designs/ .. that PHP or some CMS was at work. I know how filepaths work, etc. , but I always thought that generally simple sites were in a "flat" system

index.html
about.html
gallery.html
/css/
/js/
/images/

So today I just had one of those aha moments. And I now have my main directory with index.html, but a few folders (students/ , shows/, etc) In each of these I have an index.html page. This should essentially be the same as having students.html, shows.html in my main directory, correct? Except it would give me the kind of URL format I would like to have, yes? (eg mysite.com/students)

Problem is, my browser just shows me the directory. I see a file list with my index.html there, but the page is not loading automatically.

What stupid thing am I doing wrong? (I'm on localhost if that makes a difference). I thought that if your browser enters a directory it should load index.html (isnt that why people put blank index pages in a directory? To stop the contents from being listed?)

Upvotes: 0

Views: 203

Answers (2)

Reinard
Reinard

Reputation: 3654

If you use XAMPP on localhost, it will display the list of files instead of the index files. You can change it though, look at : http://www.astahost.com/info/tiflds-setting-default-xampp-web-server.html

If you use something else then XAMPP there probably will be an settings somewhere to set the default file to load as well. Just Google it :)

Upvotes: 0

Surreal Dreams
Surreal Dreams

Reputation: 26380

You have to configure your web server to do this. If you're running apache, it's done with a line in .htaccess like this:

DirectoryIndex index.php index.html home.html something-else.php

Those filenames are listed in order of priority, so if you have both index.php and home.html in the same folder, index.php is loaded. Usually this is set up by default, but servers can be configured a lot of ways.

Upvotes: 2

Related Questions