What is cruft?

Wikipedia provides a few definitions for the term, but the cruft that I’m speaking of is the cruft you see in bulky URLs such as http://www.website.com/index.php?id=540723&cat=3&s=search+results. Most websites these days consist of webpages that are created dynamically through a server-side programming language such as PHP or some other equivalent. When you have massive amounts of content, it’s much easier to have that content served dynamically on a website rather than creating several hundred HTML pages.

What’s so bad about cruft?

Crufted URLs are long, ugly, and hard to remember. Search engines don’t like them, due to the fact that search engines don’t trust that the crufted URLs they find are permanent. (Since they’re dynamic, there’s no guarantee that those URLs will be reliable in the future.) Crufted URLs certainly wouldn’t be too welcome on community sites that allow users to host blogs and personal profile pages. Few people would want a blog with a URL like http://www.livejournal.com/?user=myusername&page=2.

So if I dynamically create my webpages, am I stuck with crufted URLs?

Definitely not. It’s actually pretty simple to transform URLs from http://www.website.com/index.php?entry=54076&page=1 to a more “friendly” URL, such as http://www.website.com/54076/1/. Content management systems such as LiveJournal, WordPress, Mambo, and Joomla, all take advantage of dynamic page creation without having to suffer ugly URLs. Most of them use (actually, I’m not aware of one that doesn’t use this) what’s called an .htaccess file to map their dynamic URLs to a simpler, cruft-free version. If your website is hosted on an Apache server, then you can take advantage of this technique to clean up your URLs.

Apache provides a URL Rewriting Guide on their website, which details how one can use an .htaccess file to create cruft-free URLs.

You lied! You said this was simple!

Okay, so it’s not as simple as I described. In most cases, however, it’s not too difficult to implement, especially if you’re using a CMS that can generate the .htaccess rules for you. There are also dozens of .htaccess tutorials online if you want to learn how to do it yourself. In fact, I’ll go ahead and provide some useful links: