There’s nothing worse than those long, ugly URLs with twenty variables in the query string. In recent years there have been a number of websites offering a free service where users can create shorter links to these complex URLs. While a short URL is great, the links provided by most of these sites are computer generated and impossible to remember.
This weekend I programmed a simple tool to allow users to create their own links and normalize ugly URLs called normalurl.com. Just like other URL rewriting services, this website is completely free and allows anonymous users to easily create new URL redirects. However this site focuses on users coming up with their own text to create a more normal link to the long URL. These normal URLs are not only short but also simple to type and remember.
About the Development
The core of normalurl.com is built around Apache mod rewrites, which allow all the user-created pages to be redirected to a query string of a single PHP page. This page hits the MySQL database that gets created as users create new normal URLs from the homepage of the site.
This main functionality was fairly simple to build and only took a couple hours. I then added a few features, such as an engine to suggest sensible options when a URL on normalurl.com is already taken. Since none of the links can ever really be removed, the mod rewrites were written to allow the use of subfolders, so there are essentially an infinite number of normal URLs available. But there will eventually be some pile-up on the site, so the suggestion engine was built to alleviate this.
Finally, I built in a bit of reporting. Normally I use Google Analytics to gather all my site data, but all the URL redirect pages use PHP header redirects. Since Google Analytics runs on JavaScript and PHP’s header redirect breaks with any markup, I had to build in a little PHP/MySQL reporting. It was fairly easy to enter the data into a table, but I still have to program something to gather the data into useful reports.