I'm going to say this as simply as I can: web pages shouldn't have file extensions. Ever!*

The Internet is full of best practices: how to structure your web pages, how to handle redirection properly, how to design friendly URLs. For example, we know that the following URL...
http://www.somesite.com/products/videogames.htm
...is better (in every way) than this one:
http://www.somesite.com/products.htm?category=234398304&sessionid=029384029348
But both URLs suffer from another problem: they contain a file extension. Including a file extension in your public URLs isn't a best practice, it's a worst practice - or at least, a worse practice. And it's an epidemic one. Today, the vast majority of web pages serve .htm files, .aspx files, .jsp files - whatever the flavor of the month happens to be. And it works because HTTP is largely an agnostic protocol: it doesn't much care about things like file extensions, or even files. In fact, the following is a perfectly valid HTTP request:
http://www.somesite.com/marypoppins.supercalafrajalisticexpialadocious
Does it point to a file of type "supercalafrajalisticexpialadocious"? Or some other kind of resource, perhaps one that's generated from a database? HTTP doesn't know and it doesn't care. It simply requests a particular resource, and receives a response.
So, if HTTP doesn't care about file extensions, and browsers don't (usually) care about file extensions, why should we? What's so bad about having an innocuous little ".htm" or ".aspx" in our URLs?
For starters, let's look at what Tim Berners-Lee said on the subject in a classic article I've quoted before:
What to Leave Out [of your URLs]
Everything! After the creation date, putting any information in the name is asking for trouble one way or another.
- .........
- File name extension. This is a very common one. "cgi", even ".html" is something which will change. You may not be using HTML for that page in 20 years time, but you might want today's links to it to still be valid. The canonical way of making links to the W3C site doesn't use the extension.(how?)
- Software mechanisms. Look for "cgi", "exec" and other give-away "look what software we are using" bits in URIs. Anyone want to commit to using perl cgi scripts all their lives? Nope? Cut out the .pl. Read the server manual on how to do it.
- .........
And it's a valid point - who knows how long any of these technologies, with their specific and often proprietary file extensions, will be around? Even the sacrosanct .HTM extension can go extinct - for example, as more and more people switch to ASP.NET, JSP, PHP, or other dynamic content technologies. And if .HTM files can go extinct, you'd better believe that ASPXs, JSPs, and PHPs can too.
Nor is URL longevity the only thing at stake. Perhaps you don't think your pages will be around in twenty year's time, or a hundred. Maybe you don't care. But consider some of the other potential downsides:
File extensions are ugly. There's no reason in particular to confront your users with them. Sure, everybody knows what an .HTM file is. But how about .ASHX or .JSP? Do we expect every user to somehow understand Aha! JSP, that's a JavaServer Page! They're serving dynamic content using JSP! Yeee haw!
File extensions are irrelevant. A file extension contributes zero useful information. It doesn't help identify a particular page, or distinguish it topically from other pages. It doesn't extend your site's identity or branding in any way. It's an irrelevant implementation detail hacked onto the end of what could otherwise be a truly clean URL.
File extensions give away implementation details. In the lingo of object-oriented analysis and design, we'd say that file extensions violate encapsulation. They tell the world, "this is the technology I'm using, underneath the hood."
File extensions make life difficult if you ever decide to switch technologies. Let's say you've assembled a content-rich website with hundreds or thousands of pages, all tagged with a .jsp extension. You spend countless hours marketing your site, getting people to link to you, establishing a position in the search engines. Until one day, you decide it's time to make the leap to ASP.NET (or any other technology). Now you're faced with two ugly choices:
File extensions, in other words, are EVIL. By avoiding them, we not only renew our allegiance to all things good, we separate ourselves from the millions of sites that have hardcoded their allegiance to a particular technology. There's a reason why Wikipedia and the W3C, among others, use mostly extension-less URLs. We could do worse than to follow their example.
Thanks for reading, and remember, the Devil's in the details.
* - Okay, well not necessarily never. Usually, though. All other things being equal.
28 comment(s)
Your search page (www.codingthewheel.com/search.aspx) has an .aspx extension bad practice! Bad practice! :p
CodifyTheChad on Wednesday, April 02, 2008See you finally got around to implementing them (extless rewrites) yourself, goo' job! wouldn't have anything to do with the new IIS 7 execution pipeline would it? ;-) Or did you go the ISAPI Filter route?
Keith on Thursday, April 03, 2008How are you handling your form tag's action attribute? Ie, even if the URL is extensionless, doesn't the form's action attribute still point to the .aspx. extension?
Anonymous on Friday, April 18, 2008Please do tell us how did you manage to remove the aspx extension on your blog.
Mike on Sunday, April 27, 2008Mike: your site already has the .aspx extension removed! Right?
I did it by upgrading to IIS 7, enabling Integrated Pipeline mode, and then tweaking my URL rewriter (HTTP module) so that /archives/somepage gets rerouted to /archives/page.aspx?id=1392. Well, that's the idea. In practice my internal scheme is a little different than your typical "fetch a page by querystring id" technique, but it's the same principle.
In order to make sure that my internal .aspx extensions are never visible to users, and prevent URL aliasing, I also hard 404'd (alternately, if you have a lot of outstanding links you could 301 redirect) all incoming requests with an .aspx extension.
And there were a couple other details, such as rewriting the form tag so it doesn't submit to an .aspx extension on postback.
How did you implement it over at wakeIM, if I may ask?
James Devlin on Sunday, April 27, 2008James, my site is php powered (own crappy blog engine) :D ,but i'd like to switch to dotnetblogengine .
Are you running on a VPS or shared account?
Mike on Monday, April 28, 2008Why do you still use extensions for images? http://www.codingthewheel.com/pics/smile/smiley-laughing.gif
How do you know you will still use GIF in 20 years?
You may not be using GIF for that page in 20 years time on Friday, May 09, 2008http://www.codingthewheel.com/image.axd?picture=evilextension.gif
btw, you have a redirect loop in your how? link: http://www.codingthewheel.com/admin/Pages/#remove
Jens on Sunday, September 14, 2008Hey, let's remove extensions on image media like .jpg. I know, when I release my new software in self extracting exe and zip format, I'll remove the file extensions there too. Just kidding. Good article.
jagged software on Wednesday, April 01, 2009Great article James Devlin.
I recently decided to remove page extensions on my sites. They are pointless.
I also decided to go without 'www'. Nowadays having 'www' or not is purely a preference, 'www' is in fact depreciated. 'www' used to depict an internet server, while without 'www' would be an intranet server.
'www' is defined by: '[i]The complete set of documents residing on all Internet servers that use the HTTP protocol, accessible to users via a simple point-and-click system.[/i]'
Web browsers nowadays automatically prepend 'http://' onto the requested URL. 'www' is now just a useless subdomain. 'www' can be for offline advertising, when someone hears 'double-you-double-you-double-you' they immediately know you're talking about a website. This is fine, as you can 301 redirect all requests for www.example.com to example.com.
Other than that, the only reason to keep www dot is if you have a large established site with a high pagerank. Your backlinks may become invalid if you go from with-www to without-www, or vice versa.
@Mike: You're missing the point. Hiding extensions like .asp, .php, .htm, etc, is perfectly valid as the produced content of those pages are html. In the end, regardless of page extension, you're producing an html page. An image could be a gif, jpeg, png, etc, the extension conveys meaning.
[url=http://javex.org]javex.org - Security & Network Troubleshooting Tools[/url]
javex.org on Wednesday, May 27, 2009There is actually a website dedicated to [url=http://extensionless.org]Extensionless URLs[/url].
Extensionless Pages on Wednesday, June 10, 2009Does this work with PHP? I dislike ASP. I have to switch to IIS because the WebCP software is ASP Based. I know php and IIS work, But how about extensionless php files?
Anonymous on Friday, January 01, 2010This page is a lifesaver because I Google has been aware of particular pages on a website of mine that used to be PHP (now they're pure HTML), and I was hoping to keep the PHP extension, even though the pages are only HTML. I know that's not the point of your article, but you give me confidence to go for it and keep the PHP extensions for this particular site. Have a great day!
MB
MB Realty on Friday, April 16, 2010nice article. keep post like this...
Fendi replica watches on Tuesday, July 20, 2010EZ Video To WMV Converter : Best AVI To WMV, MPEG To WMV, MPG To WMV,
malin on Tuesday, July 20, 2010I loved this post so much. This was great. Keep it up!
Tudor replica watches on Saturday, July 24, 2010PerformingGraham for sale that will create a one-wayswiss watches backlink to your website whichMaurice Lacroix watches is a good point to have. It is Patek Philippe watchesa time-consuming Tag Heuer for saleprocess even though it produces good outcomes U-boat for saleand works. You can also swiss watchespost comments on blogs alongMaurice Lacroix watches together with your link, but make sureGraham watches these blogs are do-follow, which dolce & gabbana handbagsindicates the link that youreplica coach handbags simply post will probably be replica handbagscounted by the search engines jimmy choo replicaas a backlink.There are many thingsversace replica handbags that contribute to online businessjuicy couture replica failure, and the lack of good action thomas wyldeis surely one of the deadliest business-killersdolce gabbana handbags on the net. Take action like by no means chloe handbags replicaprior to, and don’t get struck by analysis paralysisburberry replica. Your achievement lies in your rapid actionchanel replica and how well you apply numerous strategies.
replica watches on Saturday, July 24, 2010nike air jordan 2010 nike air jordan 5 nike air jordan 3 nike air jordan 11 cheap nike air jordan 2 nike air jordan 1 nike air jordan shoes discount nike air jordan shoes nike air jordan 6 wholesale nike air jordan 1 discount nike air jordan 6 nike air jordan 7 nike air jordan 8 top quality nike air jordan shoes 23 nike air jordan 21 nike air jordan 22 nike air jordan 6 rings cheap nike air jordan 22 nike air lebron james shoes nike air lebron james shoes nike air jordan 2010 nike air joredan lebron james nike air jordan 2009 discount nike air jordan 2009 nike lebron james wholesale nike air jordan 2010 cheap nike air jordan 2009 discount nike air jordan 19 cheap nike air jordan 3 discount nike air jordan 18 brand nike air jordan 12 wholesale nike air jordan 2 nike air jordan 13 nike air jordan 14 nike air jordan 6 rings discount jordan shoes7 discount jordan shoes1 jordan shoes2010 jordan shoes 6 rings cheap jordan shoes2 discountjordan shoes3 discount jordan shoes4 jordan shoes uk23 jordan shoes classic bw22 cheap jordan shoes 21 ltd discount jordan shoes20 discountjordan shoes19 jordan shoes 18 uk nike air jordan shoes 17 cheap nike air jordan shoes 16 discount air jordan shoes 15 discount air jordan shoes 14 nike air jordan shoes 3 uk nike air jordan shoes 13 cheap nike air jordan shoes 11 discount air jordan shoes 6 discount jordan shoes 10 nike air jordan shoes 8 nike air jordan shoes 7 cheap louis vuitton bags cheap kobe bryant shoes cheap lebron james shoes .
cheapjordan on Saturday, July 24, 2010I will keep visiting this blog very often. Blu ray ripper /
ipad converter on Sunday, July 25, 2010air max shoes is an extremely comfortable shoe that uses a large air cushioning unit that can be seen from the side. This technology combined with the design of the shoe which is meant to compliment the spinal cord makes. Air Max shoes the ideal shoe for walking, running, playing basketball, or any other sport. nike air max ,nike air max 2009, nike air max 95, nike air max 90 and so on.Nike introduced its Air Cushioning Technology in 1979. By embedding Air Cushioning in the midsoles of its running shoes, it changed the way athletes approached and reacted to athletic performance forever.
nike air max on Monday, July 26, 2010charming Christian Louboutin Shoes best-loved Pandora Jewelry, show themselves, combined with a Zumba Fitness DVD and P90X and Insanity Workout DVD video tutorial,three Fitness Make yourself.Christian Louboutin Knockoffs,Christian Louboutin Wedding Shoes, Christian Louboutin Boots,Christian Louboutin Sandals,Christian Louboutin Wedges,Christian Louboutin Platform,P90X DVD,DVD Sales,Vibram Five Fingers,Herve Leger,Cheap Christian Louboutin,Alexander Wang Dress,Alexander Wang Shoes,Alexander Mcqueen Shoes,Giuseppe Zanotti Shoes,ED Hardy Shoes,Jimmy Choo Shoes,Chanel Shoes,YSL Shoes,Manolo Blahnik Shoes,Vivienne Westwood Shoes,Tory Burch Shoes,Louis Vuitton Shoes,Miu Miu Shoes,Salvatore Ferragamo Shoes,Marc Jacobs Shoes,Christian Dior Shoes,Herve Leger,Sergio Rossi Shoes,Lanvin Shoes,Coach Shoes,Prada Shoes,Gucci Shoes,Moncler Jackets,MBT Shoes
christian louboutin on Tuesday, July 27, 2010It is a good timberland 6 inch boots thing that the God Who made us is not impatient with people like me with my timberland shoe company orchid. He lovingly thinks about us all the time timberland boots and he even temporarily gave up His heavenly home and his timberland traditional handsewn hold on diety to die for the sins of timberland mens custom world nearly 2,000 years ago. His death back then covered the sins of every cheap timberland boots person who will ever live. He then rose to life after three mens timberland chukka days and ever since has wanted us to accept His gracious act by loving Him and also those around us. When we do this, we will see people in a totally different timberland womens premium boots light — one that redefines what it means to be ugly or different or weird or strange. Instead, we see people with ugly timberland shoes store problems in whom God is working so they can bloom beautifully — just like I now see in my orchids whether they are “lumps” or blossoms! On a certain timberland work shoes day at a certain hour, we will pull into the station. Bands will be playing and flags waving. Once we get there, so many wonderful dreams will come true and the pieces of our timberland wheat shoes lives will fit together like a completed jigsaw puzzle. How restlessly we pace the aisles, *ing the minutes for timberland for you loitering --waiting, waiting, waiting for the station.
discount timberland boots on Wednesday, July 28, 2010As a Louis vuitton cloning master, ReplicaEstore, in more than 6 years, has devoted herself to providing the best Louis vuitton wallests & handbags
Price: $33.00. Prada Replica Handbags. Top Louis vuitton wallet a Swiss Rolex replica is the best Rolex replica we can find.
Buy Replica Louis vuitton please come here, we are lowest price Louis vuitton online Replica Watches,Best Breitling,Rolex,Omega Replica Watch .
louisvuitton4 on Thursday, July 29, 2010Wholesale NFL Jerseys
Cheap NFL Jerseys
NFL Jerseys
NFL Football Jerseys
Women NFL Jerseys
Kid NFL Jerseys
Super Bowl Jerseys
Super Bowl NFL Jerseys
Throwback Jerseys
Throwback NFL Jerseys
Cheap Throwback Jerseys
Wholesale Throwback Jerseys
Cheap Super Bowl Jerseys
Wholesale Super Bowl Jerseys
youth nfl jerseys wholesale
youth nfl jerseys cheap
nfl youth jerseys
Baltimore Ravens Jerseys
Chicago Bears Jerseys
Cincinnati Bengals Jerseys
Denver Broncos Jerseys
Dallas Cowboys Jerseys
Green Bay Packers Jerseys
Indianapolis Colts Jerseys
Minnesota Vikings Jerseys
New England Patriots Jerseys
New Orleans Saints Jerseys
New York Jets Jerseys
Arizona Cardinals Jerseys
Buffalo Bills Jerseys
Atlanta Falcons Jerseys
Carolina Panthers Jerseys
Cleveland Browns Jerseys
Houston Texans Jerseys
Detroit Lions Jerseys
Jacksonville Jaguars Jerseys
Kansas City Chiefs Jerseys
Miami Dolphins Jerseys
New York Giants Jerseys
Philadelphia Eagles Jerseys
San Francisco 49ers Jerseys
Oakland Raiders Jerseys
Seattle Seahawks Jerseys
Pittsburgh Steelers Jerseys
St Louis Rams Jerseys
San Diego Chargers Jerseys
Tampa Bay Buccaneers Jerseys
Tennessee Titans Jerseys
Washington Redskins Jerseys
Ray Lewis Jerseys
Ed Reed Jerseys
Joe Flacco Jerseys
Terrell Suggs Jerseys
Dick Butkus Jerseys
Greg Olsen Jerseys
Matt Forte Jerseys
Devin Hester Jerseys
Walter Payton Jerseys
Brian Urlacher Jerseys
Lance Briggs Jerseys
Jay Cutler Jerseys
Carson Palmer Jerseys
Rey Maualuga Jerseys
Chad Johnson Jerseys
Demarcus Ware Jerseys
Jason Witten Jerseys
Terrell Owens Jerseys
Felix Jones Jerseys
Marion Barber Navy Jerseys
Marion Barber Jerseys
Emmitt Smith Jerseys
Miles Austin Jerseys
Roger Staubach Jerseys
Troy Aikman Jerseys
Tony Romo Jerseys
Eddie Royal Jerseys
Brandon Marshall Jerseys
Aaron Rodgers Jerseys
A.J. Hawk Jerseys
Donald Driver Jerseys
Greg Jennings Jerseys
Peyton Manning Jerseys
Dallas Clark Jerseys
Robert Mathis Jerseys
Marvin Harrison Jerseys
Drew Brees Jerseys
Marques Colston Jerseys
Pierre Thomas Jerseys
Reggie Bush Jerseys
Jeremy Shockey Jerseys
Tarvaris Jackson Jerseys
Adrian Peterson Jerseys
Jared Allen Jerseys
Mark Sanchez Jerseys
Thomas Jones Jerseys
Leon Washington Jerseys
Brett Favre Jerseys
buynflshop on Thursday, July 29, 2010Authentic Louis vuitton sale are listed on eBay everyday This is a ... out the more juicy obvious fakes... and will do my
best to help you
Louis vuitton Bags cooperation with Mikhail Gorbachev, the first and the last president of the USSR, produced one of the
best advertising
sale4louisvuitton.com Supply Cheap Fake Handbags, fashion designer Replica Louis vuitton, All Kinds of Bags,Purse,Wallet at low
price.You will get the best quality
louis vuitton on Thursday, July 29, 2010essay essay writing essay writing service essay writing service uk
jane on Friday, July 30, 2010Pool Temperature Madera Jobs Madera Pest Control Madera Dentist Merced Dentist Visalia Dentist Modesto Dentist Fresno Limousine Fresno Granite briefcases leather leather briefcases prospect solution | prospect solutions | prospectsolution | prospectsolutions | prospectsolution.com prospect solution | prospect solutions | prospectsolution | prospectsolutions | prospectsolution.com prospect solution | prospect solutions | prospectsolution | prospectsolutions | prospectsolution.com
carmi on Friday, July 30, 2010Want to get Ed hardy at home? No hesitation, get them at with big discount. We are promise you that all the ed hardy clothing are good in qualities. Meanwhile, buying ed hardy clothing online, that’s never a bad idea. By the way, whenever and wherever you need us, we will be there for you. Ed Hardy T-Shirts are waiting for you now, welcome you!
ed hardy on Friday, July 30, 2010