Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

I have my homepage html file, lets call it home.html

Technically, to get to that file, my user would need to go to www.example.com/home.html no?

How do I do it so www.example.com automatically runs home.html without any redirections?

share|improve this question
    
Which web server are you running? –  Shaun Jan 24 '11 at 2:16
add comment

2 Answers

If you are using Apache, naming your homepage file 'index.html' will get it to be detected at www.example.com by default. If you want to change it to accept home.html as a valid directory index page, you will need to edit the DirectoryIndex directive in your configuration file:

DirectoryIndex index.html home.html whatever_other_pages_you_want_to_list.html
share|improve this answer
add comment

Standard servers accept 3 names to auto-detect as your homepage;

  • index.*
  • default.*
  • home.*

If you're using a big webhost like hostmonster or godaddy, those 3 should be accepted.

Basically that DirectoryIndex is inside of the configuration file for Apache, which is a program that runs on servers. When your user goes to example.com, the server will look for the files on that line to display as the page, since none was specified. It goes in order of precedence, meaning the line that Shaun put up, it will look for index.html first, then if it didn't find that it would look for home.html, then whatever_other_pages_you_want_to_list.html. Index, default, and home are just the normal pages, but you can specify you're own if you'd like.

*- meaning .html, .htm, .php, .asp, .aspx, .xhtm, .xhtml, etc.

share|improve this answer
    
Apache is a pretty standard server and most distros are set up to look only for an index.htm or index.html file. –  bogeymin Jan 24 '11 at 12:17
    
@bogeymin, for generalization they'll look for an index.* file, could be index.php, index.aspx, index.jsp, etc. –  zzzzBov Feb 22 '11 at 23:49
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.