Hacker News new | ask | show | jobs
by kree10 5103 days ago
While seeing "index.html" (or "index.ANYTHING") makes me cringe, I have some sympathy for the developers who do this.

Let's say I have an old-school, all-static site with pages at http://example.com/x/index.html and http://example.com/x/about.html. I would like to make a link to the "index" page from the "about" page. What are my choices?

<a href="/x/"> will work, but will break when someone decides to move "/x" to "/y".

<a href="."> will work from the server, which does an internal redirect, but not on the static version on my local drive I'm going to demo to my boss. (I also have a hunch a significant number of developers aren't aware of "." and don't know this is an option.)

So we end up with <a href="index.html"> for better or worse.

2 comments

  <a href="/x/"> will work, but will break when someone decides to move "/x" to "/y".
If /x redirected to /y, that wouldn't be a problem.
If you're having problems like this, your web development environment is total garbage and should be fixed.

99% of the time the reason for index.html is the developer was viewing static files in their browser because they didn't have a proper server or test environment. This is inexcusable in 2012.