skip to main content

TAMU Webmaster's Blog

Information and insight from the A&M Webmasters

Use index.html, index.shtml, or index.php as the name for the primary page of your Web site

June 27th, 2007 by tamuwebmaster

If the primary page is called index.html, index.asp, etc., you do not need to specify it when linking to that URL. So, while is valid, is much easier to remember.  Note that this is dependent on server configuration, so if the server is not set up to allow this, you should talk with your system administrator about doing so.

This is also helpful for linking purposes if you or the site where you are linking changes their index page. If pages link to /visit/index.html and it gets changed to visit/index.php, for example, there is the possibility of a broken link if it is not found and changed. However, if those same pages linked to /visit/, the links will work regardless of the index page and extension.

Wednesday, June 27th, 2007 Navigation, Style Guide
Share this article

7 Comments to Use index.html, index.shtml, or index.php as the name for the primary page of your Web site

  1. While I agree completely with leaving the page name off of a hyperlink to the default page of a web site, I disagree that the page *should* be called index.whatever. It certainly *can* be, and many are, but you can call it fred.html as long as your web service is set up to know that.

    I’m not sure that you are saying the default page *should* be called index.whatever, but the title of this article makes it seem that way.

    I’m probably being really nit-picky here, but something about this one made me want to comment.

  2. Tracy Persky on June 27th, 2007
  3. While I agree that the default page can be whatever you would like it to be if a normal user is going through your site they may be uncomfortable clicking on “fread.html” links that were emailed to them from a friend.
    Even though the general user may not know what will and will not work change sometimes scares the less tech savvy and may result in them questioning the authenticity of the website if it has an “odd” name.

    Of course if you use frame headers where the actually web addressee never shows up then this is a non issue.

  4. Walter on June 27th, 2007
  5. Tracy,
    I can see where the title is a bit misleading (though based on the use of standards I’d personally agree with its implications. While fred.html is certainly a configurable default page, it’s something I’d avoid doing for several reasons. )

    The primary intent of the post was exactly the point you alluded to – when linking to the index of a directory, the better way would be to link to the directory itself, *without* the name of the file.

    Sorry if some of these posts seem self-obvious, it’s a tricky balancing act to include subtleties that the inexperienced webmaster might not know while preserving usefullness for those who have been doing it for a while.

  6. Erick on June 27th, 2007
  7. Using index.[foo] is an industry standard, and it’s especially helpful in situations where there’s a high turnover rate for the webmaster position — for example, departments whose grad students maintain the site for a semester and then move on. Yes, the server CAN be set up to accept some other file name as the default page, but whoever follows in your footsteps will have to spend time figuring out what you’ve specified, and which filenames have precedence over others. Then there are wacky situations that arise when several possible default files are present in a single directory. For example, say you did specify that the server should look for the default page at fred.html, and if that isn’t present, check for index.html as a backup. Later, someone else comes along and creates a personnel list (index.html) with bios for everyone in the department, including a page for Fred the accountant (fred.html). Suddenly the creator is tearing his hair out because his links to the personnel directory (which correctly left off the file name) are taking visitors directly to Fred’s bio, and he has no idea why.

    It’s just a standard. It protects us from ourselves.

  8. Stephanie Leary on June 27th, 2007
  9. I’m certainly not advocating calling your default page fred.html. I was just using that as an example.

    If you use .NET, your default page is exactly that: default.aspx. If you ever developed a classic ASP site with Visual InterDev or Frontpage (gag), it was default.asp. That’s all I’m saying.

    But the article is 100% correct in it’s main point, anyway.

    As I said, I was being very nit-picky. I don’t like being that way, and I purposely try to avoid it. But sometimes certain things grab me, and I can’t resist.

  10. Tracy Persky on June 27th, 2007
  11. My biggest beef with .Net is the way it actively prevents developers from adhering to established web practices. The default file name is the tip of the iceberg; its lack of support for standards-compliant markup and even simple things like root-relative links … it’s frankly appalling.

  12. Stephanie Leary on June 28th, 2007
  13. I’ve never had a problem using root-relative links in .NET.

    However, I will agree that Microsoft has never been one to follow anyone’s standards but their own, for the most part.

  14. Tracy Persky on June 29th, 2007

Leave a comment