How I made my own URL shortener

25 December, 2011 § 2 Comments

Well, this will be a short post (get it?)…

About a month ago, I registered the domain msuja.ws (as well as msujaws.com). I set up a simple page on the site that directs users to various webpages/websites about me. I’ve also been using the domain as a URL shortener, but like most lazy developers I chose the simplest and easiest route.

To do so, I uploaded an .htaccess file that does a permanent-redirect to the longer URL. Here is the current state of the file:

redirect 301 /1 http://msujaws.wordpress.com/2011/12/16/more-enhancements-for-html5-video-and-audio-in-firefox/
redirect 301 /f http://msujaws.wordpress.com/2011/12/17/nuking-parts-of-firefoxs-main-thead-io/
redirect 301 /9 http://msujaws.wordpress.com/2011/12/20/my-contributions-to-todays-firefox-release/
redirect 301 /c http://msujaws.wordpress.com/2011/12/23/announcing-cheevos-for-firefox/
redirect 301 /cheevos https://addons.mozilla.org/en-US/firefox/addon/cheevos/

To add a new shortened URL, I connect to the server via FTP and append another line.

It’s pretty easy for one person, and it’s nice to have both control over the shortener as well as letting other people know that this is a link from me that can be trusted.

Tagged:

§ 2 Responses to How I made my own URL shortener

  • A.J. says:

    Hey Hey Jared!

    I haven’t made my own URL shortener; but it does sound like a great idea! I’m glad your approach is what you were looking for! I think I might have gone a little more complicated; like PHP:

    That was just a proof of concept — then I would connect to a database and do a lookup of key to URL! I see some advantages such that if you wanted to add another entry/remove one you could have a manage page! Perhaps a statistics page too; but then we are feature creeping! :) Love the post!

  • A.J. says:

    Whoops didn’t have source in sourcecode tags:

    <?php
    header('HTTP/1.1 301 Moved Permanently');
    header('Location: http://msujaws.wordpress.com/');
    exit();
    ?>
    

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

What’s this?

You are currently reading How I made my own URL shortener at JAWS.

meta

Follow

Get every new post delivered to your Inbox.

Join 1,013 other followers