dntd.cc URL Shortener Active

Last night I set up my new domain http://dntd.cc (it’s not very exciting if you visit it) to handle all my own URL redirections from now on. I’d been meaning to do this and in light of Tr.im’s imminent demise I thought it was prudent to go ahead and do it now. This is not (and will not become) a public service, it’s purely for my own use.

After looking around at some options, I settled on using YOURLS to power dntd.cc, for a couple of reasons:

  1. It’s lightweight and pretty simple
  2. It’s written by 2 people I know of, and respect, who are prominent members of the WordPress community
  3. It comes with a companion plugin that allows me to automatically create short URLs for all of my WordPress Posts and Pages
  4. I can also add arbitrary shortlinks using a very simple admin interface if I want to link to something else.

With all those benefits in mind, here’s what I had to do to get it running:

  1. Register and set up dntd.cc, confirm that it was resolving and that I had access to that directory (long story, but this was more complicated than it should have been 😉 )
  2. Copy all the YOURLS files into that directory
  3. Create a new database to hold things
  4. Set up the config file at /includes/config.php with your database details
  5. Run the install script at /admin/install.php which gets YOURLS set up and installed
  6. At this point you’d think you were ready to go, but I realized that I really needed to set up some Apache Rewrites and stuff to really have my site running. I removed these files:
    1. public-sample.php
    2. readme.html
    3. test-api.php
  7. Then I dropped in this .htaccess file to handle redirecting shortlinks to where they need to go:
    RewriteEngine On
    RewriteBase /
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ([0-9a-zA-Z]+) yourls-go.php?id=$1
    
    Options -Indexes
  8. Then I went ahead and grabbed the WordPress plugin for YOURLS and installed that, and configured it just to do these things:
    1. My own install,
    2. Local, on the same webserver (and entered the path to my config file)
    3. Skipped my Twitter login details and then set it to generate a short URL on Post and Page publish

Now, whenever I publish a new Post or Page, there’s a new box on the right of my edit screen that tells me my shiny new short URL. If I want to create my own shortlink for anything non-WordPress, I just log into the YOURLS admin interface and I can do so very quickly.

  1. I just set this up the other day. The only addition I am going to make is to toss a copy of the newly created shortlink under the post title. I figure this will make it easier if people would like to tweet my post or send the link to their friends via other modes. Now I just gotta find the time to modify those php templates.

    Additionally, I feel like people who read my blog trust me and hopefully they know that any linked item that has the http://thedig.in domain is going to be spam free and spyware free. Now I just have to be sure to link to interesting stuff.

    • beaulebens said:

      When I get a chance I'm going to modify the Sociable plugin that I use (which adds those sharing icons at the end of each post) so that it will use my shortened URL rather than the full permalink. That should also help people to use the short version where it makes more sense.

Comments are closed.