The importance of a semantic URL

I’m constantly baffled why most companies and web developers don’t understand, or care about, the importance of using good semantic URLs. Therefore, I though I’d outline some reasons to help you understand why you really should care.

What is a semantic URL?

Semantic URLs, also known as Friendly URLs, are made up of logical parts, therefore showing the actual name of the specific web page you’re watching, while at the same time displaying where it belongs in the web site hierarchy. Let me give you some examples:

Bad URLs

http://www.example.com/?id=547

http://www.example.com/aspx?id=547&product=785

http://www.travel-example.com/?continent=3&country=15&city=54

Good URLs, made from the samples above

The bad examples above can actually mean something like this in reality:

http://www.example.com/contact

http://www.example.com/products/screwdriver

http://www.travel-example.com/europe/sweden/stockholm

See just how much better it gets? Another thing I dislike is when file extensions, like .php or .aspx , are part of the URL. What’s ridiculous about that, too, is that isn’t the content of the PHP or ASP.NET file that is presented, its the content that it generated that is shown to the end user. I’m all against the usage of any file extension in the URL, but the only one that would make sense at least some sense is .html , because that is what is served to the web browser.

Why it’s important?

As you can see in the bad vs.good examples above, the proper ones convey meaning and structure, while the bad ones aren’t really useful to anyone (except for some web developers, but their target should really be the end user, not a digit that helps them find something in, say, the database).

Usability

I think that with a web site with a good structure and semantic URLs, you can guess the URL. Simple things like /contact and /about , but also more complex ones like http://www.tv-example.com/programs/lost . As long as you know the domain name, it should pretty much be possible to navigate around solely through the web browser location bar.

Just take the travel web site URL as an example; companies dealing with lots of destinations but don’t have semantic URLs are far beyond me. Doesn’t the technical solution support it? Tough! Get a better one.

SEO

From a search engine perspective, naturally http://www.example.com/products/screwdriver makes more sense than http://www.example.com/?id=547 , and they can index the web pages in conjunction with their content, to verify what it’s really about, and just how important it is in the web site’s context. For instance, http://www.example.com/products/hammer will most likely be more important than http://www.example.com/products/expired-products/1975/disco-belt .

If the URLs only would have been id-based, there would be now way of telling the difference between the top-seller and the most tiny unimportant one.

For the web developers

To go with the structure of the web site, the web development environment should be mirroring all parts. Therefore, the web developer can easily find the exact section that needs to be altered, leading to easier maintenance and logical implementations. Also, in the long run, you can easily change id’s and structure of the database without the need of worrying about users who have bookmarked certain web pages. As long as the semantic structure you front with is intact, you can have full control behind the scenes.

How to create friendly URLs