How many times have you tried to remember the URL of a particular website, but the address had resulted in a jumbled mix of letters, numbers, forward slashes, back slashes, question marks, ampersands, percent signs, dots, dashes, and underscores? Happens a lot, I know, especially with dynamically-generated web documents. These unattractive URLs are not only hard for you to read and remember, but search engines have the same problem with ranking them in a usable and reliable format. Several case studies, including this one from Search Engine Watch, have shown that when a website updates their dynamic URLs to a static form, their search engine ranking improves significantly. Keywords, SEO, meta tags, and tags all help to get around the search engine issue, but this still does nothing to aid the user who would like to relay the URL to someone over the phone or in person. According to the Google Webmaster design and content guidelines:

“If you decide to use dynamic pages (i.e., the URL contains a “?” character), be aware that not every search engine spider crawls dynamic pages as well as static pages. It helps to keep the parameters short and the number of them few.”

Your home or office has a set format for its street address, which is typically a set of ordered and sequential numbers followed by the street name, city, state, and zip code. I have always wondered why it is that many web addresses do no follow a similar structure or nomenclature. The URL for a website serves the same purpose as a street address, though they seem to have no set format once you get beyond the domain name. Of course, I know the reason why website URLs are not always generated in a user friendly manner, but the real question is why are web developers allowing their site URLs to be generated in this fashion?

In several cases the issue with unfriendly URLs involves an “easier said than done” solution. The following are several solutions for both static and dynamic URL web re-addressing.

Apache Server – mod_rewrite: Also known as the Swiss Army Knife of URL manipulation, this Apache module uses a rules-based rewriting engine to rewrite requested URLs on the fly. The module operates on the full URLs both in per-server context as with the main configuration file (httpd.conf) and per-directory context as with distributed configuration files (.htaccess). Several Apache mod_rewrite resources:

ASP.NET: Several options include using the Request.PathInfo property without the need for Query string values. And another method utilizes the HttpContext.RewritePath(), allowing dynamic re-writing of all incoming URLs as they reach the server, thus forcing them to call a single Products.aspx page that takes the category name as a Querystring or PathInfo parameter in its place. Instead of doing all this coding on hundreds of web documents there are several HttpModules available for free that can automate the process within your application’s web.config file:

Microsoft ISS – URL rewrite: The URL Rewrite Module is also closely aligned with .NET and it enables web administrators to create rules to implement URLs that are easier for users to remember and for search engines to find. Using rule templates, rewrite maps, .NET providers, and other functionality, Web administrators can set up rules to define URL rewriting behavior based on HTTP headers, HTTP response or request headers, IIS server variables, and other complex programmatic rules. Several URL Rewrite resources include:

Other Tools: Several online tools that can assist with rewriting URLs are listed here:

  • SEO Tools: URL Rewriting Tool – Enter your dynamic URL and hit submit, and then this tool helps you convert dynamic URLs into static looking html URLs.
  • .htaccess URL Rewrite – Enter your dynamic URL, the extension, and any separators, then click the create .htaccess button, and this tool will convert your long and dynamic address into a short and search engine friendly URL.

Does your web development house use any URL rewriting tools or processes? If so, please tell us about your experiences with rewriting URLs.

Subscribe to the Developer Insider Newsletter

From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays

Subscribe to the Developer Insider Newsletter

From the hottest programming languages to commentary on the Linux OS, get the developer and open source news and tips you need to know. Delivered Tuesdays and Thursdays