How to Change the Default Web Page that is Shown When Someone Goes to Your Domain Name

Set the Directory Index Page to Something Different

How to Change the Default Web Page that is Shown When Someone Goes to Your Domain Name

by Christopher Heng,

One of's visitors wrote to ask me how he could make a certain page the default web page that is displayed when his visitors go to his site's domain name. For example, he wanted his visitors to see the web page located at "" when they typed his domain name, This article explains how this can be accomplished.

Before You Read On

The Easiest Way

If your web page is just a normal HTML file, like (say) "home2.html", the easiest way is to simply rename it to "index.html". Most (if not all) web servers will automatically serve that file when your visitors go to your domain without any filename (like "").

Using a standard name like "index.html" not only solves the problem, but it may also help when search engines discover that has an identical page to Since this is the case for most websites, an intelligent search engine can simply regard it as the same page, and not treat it as a duplicate, causing all sorts of duplicate content problems.

This should be the method you use, unless you have special reasons for not wanting the standard filename.

How to Modify the Directory Index Filename on Apache Web Servers

For some people, the above method is not possible. For example, you may want to invoke the script instead of an ordinary web page.

If your site is hosted on an Apache server, you should create an text file using a plain text or programmer's editor with the following line:

DirectoryIndex special.php

You should of course use the actual file name you want as the directory index instead of "special.php".

In addition, if you want (say) the web server to serve the "special.php" file by default, but if it's not present, to display the "index.html" file, do the following:

DirectoryIndex special.php index.html

You can add other filenames to that list if you wish. Separate each filename from the others with a space.

Some things to note:

Save the file as ".htaccess". If you use Notepad, be sure to include the quotation marks around the filename, or Notepad will add a .txt extension to your file without telling you. Notice that the name begins with a full stop (period) and is entirely in small letters (lowercase). Do not change the name.

Finally, upload the file to the top web directory of your website (the folder where you put the site's home page). Make sure that your FTP program uploads it in text mode, and not as a binary file.



With the above steps, you have changed the name of the default web page for your domain when it is requested without an additional folder name or filename.

Copyright © 2008-2020 by Christopher Heng. All rights reserved.
Get more free tips and articles like this, on web design, promotion, revenue and scripting, from

thesitewizard™ News Feed (RSS Site Feed)  Subscribe to newsfeed

Do you find this article useful? You can learn of new articles and scripts that are published on by subscribing to the RSS feed. Simply point your RSS feed reader or a browser that supports RSS feeds at You can read more about how to subscribe to RSS site feeds from my RSS FAQ.

Please Do Not Reprint This Article

This article is copyrighted. Please do not reproduce or distribute this article in whole or part, in any form.

Related Articles

New Articles

Popular Articles

How to Link to This Page

It will appear on your page as:

How to Change the Default Web Page that is Shown When Someone Goes to Your Domain Name

Link to Us
No Spam Policy
Privacy Policy
Site Map

Getting Started
Web Design
Search Engines
Revenue Making
Web Hosting
Perl / CGI
.htaccess / Apache


Free webmasters and programmers resources, scripts and tutorials Free How-To Guides
Site Design Tips at
Find this site useful?
Please link to us.