2

If I maintain www.example.com, does accessing it mean I would open index.html in its root directory?

7

What will occur depends on how you have setup your web server.

A web server may be setup to display an index page - that is a page that is displayed when a directory is accessed. In this case, the server will typically try all the files listed (e.g. index.htm, index.html, index.php, etc) in the order listed, and display the first one that is available, or an error if none are available. While 'index.*' is commonly used, it is not required. Web servers typically allow you to specify the index file, and will load the corresponding file.

Alternatively, your web server could be setup to display the content of a directory - in this case, it will not serve the index page, but rather a listing of all the files in the directory.

Of course, your server could be setup to do something completely different, such as redirect the user to a specific page or another site.

You should be able to check your access (and error) logs to determine what exactly occurs for your particular scenario.

2

Depending on the webserver you're running and its configuration, yes.

It is very common that index.html is read from the folder the webserver points to if you don't add a filename in the URL. In Apache, for example, these filename(s) are defined in the configuration with the directive DirectoryIndex.

In Microsoft IIS default.asp is a common default filename.

  • I think I'm using Apache. – stanigator Jan 5 '12 at 3:49
  • Then its right, and like I said, defined in DirectoryIndex if you would want to change or add more. Other common ones added could be index.php and index.htm (to support Windows 3-letter filesuffix). – Mattias Ahnberg Jan 5 '12 at 4:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy