Make your web site’s first page – the index.html file

The first page you need to make when you make your web site is the index file. This is the web page where a visitor will be greeted when they key in your web site domain in their browser. You may say this is the entry point to start browsing your web site though it may not necessary be the first page a visitor will visit if they find your web site through a search engine. If they came in via the web site address that you supplied, then this index file will the first page where your visitors will drop in to your web site.

Basically this filename in its complete form of file+extension will be index.html. Why use the .html extension? Well actually you can use other form of extension like .htm. However it always better to use the usual commonly used extension for consistency and thus the .html will be the standard extension to use.

What about the other form of extension like .php, .shtml, or even .asp? These are rather special and refer to web pages that are coded to run on server side as oppose to client side. What it means is that to the visitor the pages are formed and created before the pages are displayed on the visitors’ browser. While client side requires the visitor’s computer to render the web page code on his PC before it is displayed on his browser. If this seems rather complicated then just leave this concept on the table for the time being.

Whenever you type in a domain name eg the first thing the browser will look for is the file called the index.html. This is also true if you have a subfolder eg, then the first file it will look for in the subfolder would also be an index.html file. You could actually control and modify which file a browser to look for by modifying the htaccess server file in the folder, but basically the main file a browser will automatically look is the index.html file.

Advance technique to set the default file other than index.html
Include this command in .htacces file:

# Set the default handler.
DirectoryIndex index.html

If your new index file is called hello.php, then change the above index.html to hello.php. So when someone logs in to your web site they will end up on hello.php.

Usually it is prudent to have an index.html file for each subfolder within your web site. This would prevent visitors from accidentally viewing all your files and folders within that subfolder. However there is another way to prevent visitors from viewing the subfolders by preventing access using the .htaccess file should you prefer not to create an index.html file for every subfolder that you create in your web site.

Technique to prevent visitors from looking at any of your subfolder in your web site. Include this command in your .htaccess file:

# Don't show directory listings in a directory.
Options -Indexes

So this wraps up the explanation about index.html, the first file that a browser will load up whenever a website address is keyed in the address bar.

HTML tutorial with video

More related HTML tutorials

Leave a Comment

Your email address will not be published.

Blue Captcha Image


This site uses Akismet to reduce spam. Learn how your comment data is processed.