Folks, I'm trying to grapple with something which is making my head spin. I wonder if someone might have an idea on this.

It's well understood, that a webserver can supply a specified file, by default, if no page is specified on the URL:
eg.
http://www.london.edu/index.html
can be requested by the URL
http://www.london.edu/
because index.html is configured as a default page.

I'm trying to discover if Apache offers the feature to specify the default page on a folder-by-folder basis.
eg.

http://www.london.edu/index.html
can be requested by the URL
http://www.london.edu/
by configuring index.html as a default page for the root folder.

and also

http://www.london.edu/phd/phd.html
can be requested by the URL
http://www.london.edu/phd/
by configuring phd.html as a default page for the phd folder.

and also

http://www.london.edu/mba/mba.html
can be requested by the URL
http://www.london.edu/mba/
by configuring mba.html as a default page for the mba folder.

etc.

I'm not sure if I'm reading it right, but this page may have some bearing.
http://httpd.apache.org/docs-2.0/mod/mod_dir.html

Many thanks for any light you can shed on this. I'm certainly in the dark.

You will want to add:

DirectoryIndex

to the .htaccess file for each directory. There may be another way to do this, but this should work.

So for example:

In the directory: phd/
add this line to your .htaccess: DirectoryIndex phd.html

Many thanks. I'll give it a go.

And it worked....

Using Apache on Windows:
1. Install.
2. Modified httpd.conf to change "AllowOverride None" to "AllowOverride All"
3. Created folder called phd within folder htdocs.
4. Put a file in this folder, called phd.html
5. Used command line to create .httaccess in the folder phd.
6. Put one line in the .htaccess file: DirectoryIndex phd.html
7. Restarted the server.

RESULT!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.