5 ms·
The thing that drives me up the wall is "index.html" - that's pretty much inexcusable in my opinion. There are even some sites where the root path on the domain
by simonw 14y ago
The thing that drives me up the wall is "index.html" - that's pretty much inexcusable in my opinion. There are even some sites where the root path on the domain REDIRECTS to example.com/index.html - don't do that.
- kree10 14y agoWhile 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 http://example.com/x/index.html and http://example.com/x/about.html 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.
- simonbrown 14y ago<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.
- astrodust 14y agoIf 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.
- andyjohnson0 14y agoI don't get it - why is index inexcusable as part of a url?
- dredmorbius 14y agoThe index object should be the default page opened by a webserver for any given unspecified path. Eg: http://www.example.com/path/to/url/ http://www.example.com/path/to/url/ should open to the first specified of the the specified default objects, typically index.html index.shtml index.php index.php, or similar. This is defined in your Apache conf file, or locally via .htaccess. If you want to refer to a specific non-index page, you'd specify http://www.example.com/path/to/uri/somepage.html http://www.example.com/path/to/uri/somepage.html
- andyjohnson0 14y agoI understand that: index.html is just one possible name for the "default page" filename. IMO its perfectly valid (if redundant) to specify it explicitly in a url. I still don't understand why this was described (not by you) as unacceptable.
- dredmorbius 14y agoBecause it's presenting an implementation detail. If I change my file formats from HTML to SHTML, .jsp, .php, etc., the URL changes. If I change from files to directories for every possible URL instance, the URL changes. The user shouldn't care.
- andyjohnson0 14y agoEarlier you said: "If you want to refer to a specific non-index page, you'd specify http://www.example.com/path/to/uri/somepage.html http://www.example.com/path/to/uri/somepage.html " So, is this presenting an implementation detail as well? I only asked my original question because I thought I was missing something...
- dredmorbius 14y agoFair gripe. If you'd started with the 'document'-.'html' naming convention, you could use any of numerous webserver hacks to preserve this illusion. How you request something has little to do with what the server does to satisfy your request. What I was distinguishing earlier was the distinction between 'return default index of this level of the path' and 'return a specific document from this level of the path'. Specifically indicating 'index.html' is a tad gauche.