Isaiah Bugarin
Isaiah Bugarin

Reputation: 493

How to make home page for website?

I have all the code for my website's home page as "home.html", however I want to be able for someone to just type in "example.com" and go to the "home" page instead of having to type in "example.com/home.html". How do I do this?

Upvotes: 0

Views: 886

Answers (3)

Anders Lindahl
Anders Lindahl

Reputation: 42940

Web servers are usually configured to serve a file with a specific name when asked for the root level of a directory. Some examples are:

  • index.htm
  • index.html
  • index.xml
  • index.rxml
  • index.asp
  • default.asp
  • default.aspx
  • index.php
  • index.cgi
  • index.shtml
  • iisstart.htm

As you understand, this can vary greatly from server to server and from configuration to configuration.

So, either re-configure your web server to treat "home.html" as a valid home page, or change its name to whatever your server is configured to use.

In Apache, this is configured with the DirectoryIndex directive.

In IIS, these are called Default document.

Upvotes: 5

Dot Cink
Dot Cink

Reputation: 381

For Apache:

DirectoryIndex home.html index.html index.txt

For nginx:

location / {
    try_files $uri $uri/ /home.html;
}

Upvotes: 1

Oleksi
Oleksi

Reputation: 13097

Name your homepage index.html, and it will be the page your website automatically goes to when users go to example.com

Upvotes: 1

Related Questions