Levinshtein link fixer (aka the Levinator) code, now available

Well, after spending 45 minutes trying to figure out github, I’ve realized I’m not as much of a nerd as I thought.

So, in the mean time, here’s a nice ZIPped archive of the code for the Levenshtein link redirector I’ve written in PHP. I’ve named it the Levinator – Dr. Doofenshmirtz would be proud.

I’ve talked about it before, but here’s the rundown.

What it does

This tool compares a list of good URLs and 404 URLs.

Then, using Levenshtein distance calculation, it figures out the closest-matching good URL for each broken one.

Finally, it generates a list of 301 redirects, .htaccess-style, so you can set up redirection.

Requirements

You’ll need:

  • PHP
  • Basic knowledge of coding (very basic)
  • A list of good URLs on your site
  • And a list of 404 errors – easy to get from Google Webmaster Tools

License

I’m releasing this under Creative Commons Share-Alike and require attribution.

Creative Commons License
The Levinator by Ian Lurie is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.

Have at it:
[ Download the Levinator ]
portent logo

Tags:

Ian Lurie
/ @portentint
Portent's Founder & CEO

Ian Lurie is founder and CEO of Portent Inc., an internet marketing agency that has provided internet marketing, including PPC, SEO, social and analytics services, since 1995. more >

Comments

6 Responses to “Levinshtein link fixer (aka the Levinator) code, now available”

  1. Christian - October 16, 2010 at 4:52 pm #

    This looks like a very handy tool. How exactly does it find the closest-matching URL? Can you explain that in a bit more detail, or maybe give an example?

  2. Chuck Reynolds - October 16, 2010 at 10:55 pm #

    Use Forrst.com or something… github can even do simple code snippets just to share if you want to do that route. Forrst is cool tho.
    Have an invite if you need it.. email me if you do.

  3. Ian - October 18, 2010 at 7:29 am #

    @Christian it uses Levenshtein distance calculation. You can read up on it on Wikipedia.

  4. Kris Shaull - October 18, 2010 at 2:09 pm #

    Great tool…nice to know other parents are familiar with Dr. Doofenshmirtz.

  5. Roger - October 18, 2010 at 11:34 pm #

    I’m probably also not much of a nerd either, or maybe it’s just too early in the morning: I don’t quite understand what problem this Levinator solves, or in what situations this might come in handy? Is this for people that frequently have links with typos on their site?

  6. Ian - October 19, 2010 at 8:42 am #

    @Roger Often when other sites link to yours, they’ll put in typos. Either they leave out part of a URL (because it wraps) or they otherwise screw up the link.
    If you have a large site, these external links can number in the hundreds or thousands.
    The Levinator tries to match them up with working URLs.