6 ms·
One thing that's always bugged me is file extensions...I hate having to type ".php" or ".cgi" or ".asp" or whatever else just happens to reflect the server's im
by makecheck 14y ago
One thing that's always bugged me is file extensions...I hate having to type ".php" or ".cgi" or ".asp" or whatever else just happens to reflect the server's implementation at the time. If they switch from Microsoft to LAMP then their URLs will probably all break needlessly.
It can be much worse though...exposing machine names, unnecessary complexity and parameters, all changing from year to year.
A server doesn't have to puke its implementation details everywhere. I can't even count all the "enterprise" apps that make that mistake (e.g. a helpdesk system that gives me "serverNameThatWillChangeNextYear.domain.net/some/unnecessarily/convoluted/path.unnecessaryExtension?whatthehellisallthis&garbage1=a&garbage2=b&finallyRelevantBugNumber" instead of a stable URL like "company.net/bugs/bug123456". And just try E-mailing a complex URL to somebody (it wraps, and time is spent to awkwardly correct it).
Honestly, it's as if most web developers don't understand how powerful URLs can be. If you make URLs short and stable and use them to help look up stuff, they can be very nice. Instead in the past I've seen people E-mailing 9-step instructions on how to find something because the damn URL is unreliable.
- simonw 14y agoThe 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...
- dangrossman 14y ago> Honestly, it's as if most web developers don't understand how powerful URLs can be. Or, more likely, most of the "enterprise" apps with those URLs were first released over a decade ago, when the idea of "pretty URLs" was not yet mainstream. There was not even a mention of mod_rewrite on Wikipedia at that point. The article on the front controller pattern, which most webapps that handle their own URL routing use, wasn't written until 2008.
- apike 14y ago> most of the "enterprise" apps with those URLs were first released over a decade ago, when the idea of "pretty URLs" was not yet mainstream. Or, even more likely, the enterprise customer never specified "URLs that aren't terrible" in their 100-page RFP, and so the lowest bidder didn't bother with URLs that aren't terrible.
- dredmorbius 14y agoThe first URLs were short and sweet. HTML, and server paths / CGIs were largely hand-coded and short. The URI explosion occurred in the late 1990s / early aughts for the most part with Java and Microsoft entering the fray from my recollection.
- iy56 14y agoSo like he said, over a decade ago.
- readme 14y agoWhen working with apache, one can use the option MultiViews to easily perform content negotiation without the file extension in the uri. If I do find myself working with LAMP (which a lot of people still use) then I use this option, and my uris magically no longer end with ".php"
- maigret 14y agoProblem ist most companies don't have someone who actually owns the URL namespace. Or the engineer who wrote that bug reporting tool was too shy to contact the CIO, etc. I agree with your point, but it's also valuable to understand the structural reasons that prevent such things.
- porges 14y agoOn a related tangent, can we please have an operating system that eschews extensions and instead stores the MIME type for each file?
- rdl 14y agoThe crazy mac resource fork thing isn't exactly better.
- kalleboo 14y agoMac OS X? http://en.wikipedia.org/wiki/Uniform_Type_Identifier http://en.wikipedia.org/wiki/Uniform_Type_Identifier
- wmf 14y agoBeOS did that. I think it's a shame that OS X seems to be moving backwards in this respect.
- astrodust 14y agoFiles used to be tied to applications directly. While I prefer the BeOS approach of MIME-type, it's not nearly as user-friendly as a file extension. OS X tries to hide extensions by default, which like the behavior in Windows that's similar, seems dangerous. Too many times people have been stung by sexy.jpg.exe.
- jamesbritt 14y agoUgh. I have that in the konqueror file browser. It beleives that my .epub files are zip archives, so the default handler is not an epub reader.
- dredmorbius 14y agoWhat's file(1) say about those files? If it's bad magic, update your distro. If it's a Konqueror error, file a bug. I'd be surprised if upstream hasn't addressed this (quick DDG/Google doesn't turn up any similar complaints).
- gioele 14y agoBright people use other people's problems to their advantage: in pg's viaweb they deliberately put extra `cgi-bin/` every here and there just to confuse their competitors. http://news.ycombinator.com/item?id=4589 http://news.ycombinator.com/item?id=4589
- kree10 14y agoI think some organizations see this kind of implementation leakage as a feature, not a bug. I remember when http://microsoft.com/ http://microsoft.com/ began doing external redirects to "default.asp" circa 1997. If you were a "webmaster" (do these exist anymore?), this was a dog whistle. They were not using static .html (or .htm) but not any of the common dynamic methods like .cgi or .shtml either. And using "default" rather than "index" indicated a break from NCSA/Apache convention. They were using a different web server. Those 11 extra characters said a lot.