Computer Science Canada

A folder that acts like a file?

Author:  HazySmoke)345 [ Tue Mar 13, 2007 3:53 pm ]
Post subject:  A folder that acts like a file?

The following URL leads to the homepage of this web site.

http://www.compsci.ca/v3/

You notice how there is no file name under the folder v3? I was expecting it to be like www.compsci.ca/v3/blahblah.html, but I don't see the filename at all.

How is this possible?

Author:  octopi [ Tue Mar 13, 2007 4:10 pm ]
Post subject:  Re: A folder that acts like a file?

Its called the DirectoryIndex, it is usually set to index.html or index.php

If a file name isn't specified it loads the index.html, or index.php file.

Read up on the apache documentation (if your webserver is apache), more specifically the 'DirectoryIndex' directive.

Author:  bugzpodder [ Tue Mar 13, 2007 5:43 pm ]
Post subject:  Re: A folder that acts like a file?

in *nix, folders are special files

Author:  PaulButler [ Tue Mar 13, 2007 6:50 pm ]
Post subject:  RE:A folder that acts like a file?

It can also be done dynamically. Google mod_rewrite if you are interested.

Author:  rdrake [ Tue Mar 13, 2007 7:36 pm ]
Post subject:  Re: A folder that acts like a file?

bugzpodder @ Tue Mar 13, 2007 5:43 pm wrote:
in *nix, folders are special files
In *nix, everything is a file!

Seriously though, yes, every server has a way to specify the default file if none is specified. Typical examples include the following.

  • index.html
  • index.php
  • default.asp
  • default.aspx
  • Etc.
Mod_rewrite is a good one too.

Author:  md [ Tue Mar 13, 2007 10:50 pm ]
Post subject:  RE:A folder that acts like a file?

Or just rewrite for lighttpd. I should really start plugging lighttpd whenever someone says something about apache.

Author:  PaulButler [ Wed Mar 14, 2007 9:18 am ]
Post subject:  Re: RE:A folder that acts like a file?

md @ Tue Mar 13, 2007 10:50 pm wrote:
Or just rewrite for lighttpd. I should really start plugging lighttpd whenever someone says something about apache.


lighttpd is a nice server, I left it out of my post in order to not confuse things.

I like mod_rewrite better because it can be written in the .htaccess file, doesn't lighttpd require it be in the lighttpd.conf file? Unless there is a way around it, this would get annoying.


: