0

As I'm quite newbie to this field, I've doubts and there are some I couldn't find on Google, i.e:

If I'm not wrong, index.html makes it possible to avoid to add the filename to the url, www.example.com/ is equal to www.example.com/index.html. And that works for the following subdirectories, right? www.example.com/music/

  • Is there any other way to achieve this without using an index.html file? (I've read smth about converting dynamic urls to static: ./?var1=value1&varN=valueN -> ./value1/valueN)

  • How can I convert www.example.com/music/ to music.example.com/ and why should it be used?

Thanks in advance!

  • 1
    For the "should" part of the question, there are many previous threads already. – Su' Sep 13 '11 at 17:49
3

You can define which file acts as the entry page. On an Apache server, you do this with a file named .htaccess which you place in the root directory (or in a specific directory). This file is a normal text file, with following line you define an entry page:

DirectoryIndex hello.html

Now, if anybody calls your directory http://www.example.com, the page http://www.example.com/hello.html will actually be shown.

The filename index.html is just a convention. If no entry page is defined, the server tries a few default filenames like index.html, index.php, etc.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.