How to Create an Index File

By Eric Hammer

Updated April 06, 2018

i Comstock Images/Comstock/Getty Images

Creating an index file is a necessity for anyone who plans to run a website. An index file is the first web page that anyone visiting your website will see, and it need to be named “index.htm” or “index.html” in order for web browsers to find it. If you simply upload pages to your website without first creating an index file, your visitors may see (depending on the browser and your website host) either a page saying that the site is “parked,” an index with a file tree showing the pages you uploaded, or even an error message.

Click the “Start” button. In the “Search” field, type “notepad.” Press “Enter.” Note: You can also find Notepad by clicking on “All Programs,” clicking on “Accessories” and then clicking on “Notepad.”

Type “<html>.” Press “Enter” and type “</html>.” Within these two tags, you will write whatever you want to have on your index file.

<html> </html>

After “<html>,” press “Enter,” creating a blank line between it and the “</html>” you entered earlier. Here, you will enter in several additional pieces of your website. Type “<head>” and then press “Enter.” Now type “<title>.” Follow this with the name of your website. This will not be displayed in the browser window. Instead, this will be displayed in the title bar (that is, when you visit a page like “Google.com,” it says “Google” in the title bar.). Now type </title> and press “Enter.” Type “</head>” and press “Enter.”

<html> <head> <title>My Website!</title> </head> </html>

Type “<body>” and press “Enter.” Here, you will enter the actual content of your website. For example, if you wanted a title to be displayed in the browser window, you might type “<h1>My Great Web Site</h1>.” Or, if you wanted a link, you would type <a href=”website.com”> Great website</a>.” You can use the resources mentioned below to help you learn more about HTML commands that can be incorporated into your index file. Once you have finished typing whatever will be visible on the front page of your website, simply type “</body>” and then press “Enter.”

<html> <head> <title>My Website!</title> </head> <body> <h1>My Great Web Site</h1> <a href=”website.com”> Great website</a> </body> </html>

Click “File.” Click “Save as.” Select “All files.” Type “index.html.” Press “Enter.” Your index file has now been created.

Tips

Web browsers don’t care about page breaks or paragraph breaks. So, for example, if you were to write <html><head><title>My Website</title></head><body><H1>This is My Great Website.</h1><p><a href=http://www.myfriendswebsite.com>This is my friend’s website. Check it out.</a></p></body></html>.

The website would still format the same way, regardless of whether you put in page breaks or paragraph breaks. However, it is usually helpful to include paragraph breaks, since these will let you see more clearly what you are doing on your index file.

It is also not strictly necessary to use the” <HTML>,” “<Head>” and “<Body>” tags, though these make for cleaner web page writing and can be useful in some cases.

Warnings

Always remember to put tags in pairs (i.e. if you start” <h1>” in order to create a headline, make sure you finish it with “</h1>.” Otherwise, your entire website will be displayed as a heading.

×