Hiding Extensions from URLs

Twitter Updates


San Francisco PechaKucha Night
San Francisco IxDA


Once I had finished getting the MIME type modified on-the-fly, I remembered Tim Berners-Lee’s description of Cool URIs, advising authors to leave out tons of things from URIs, including file extensions. So I added the following to the .htaccess file in the root of my Web server:

options +multiviews
AddType application/xhtml+xml;charset=utf-8 .xhtml; qs=1.0
AddType text/html;charset=utf-8 .html; qs=0.9
AddType image/mng; .png qs=0.95
AddType image/png; .png qs=0.90
AddType image/gif; .png qs=0.85

This also allows you to do a poor-man’s immitation of the fallback that nested <object> tags are supposed to provide, but don’t because IE shows ’em all, not just the first one that renders.

Author: Peter Sheerin

Peter Sheerin is best known for the decade he spent as the Technical Editor of CADENCE magazine, where he was the acknowledged expert in Computer-Aided Design hardware and software. He has a long-standing passion for improving usability of software, hardware, and everyday objects that is always interwoven in his articles. Peter is available for freelance technical writing and product reviews, and is exploring career opportunities in interaction design. His pet personal project is exploring the best ways to harmonize visual, tactile, and audible symbols for improving the effectiveness of alerting systems.

Leave a Reply