In: , , ,
On: 2009 / 06 / 25
Shorter URL for this post: http://ozh.in/m8

So, if I didn't forget to upload a zip archive or to press a "Commit" button, it should be all here for you: the GPL'd URL shortener I wrote about earlier that Lester Chan and I have been using for a while now.

yourls-logoOur URL shortener service is called YOURLS, as in Your Own URL Shortener. It's all GPL, free, do-what-you-want-with-it. Lester is running it on his own domain lc.sg, I'm running it on ozh.in, and it's fun :)

A companion for YOURLS is a WordPress plugin (of course) that will generate short URLs for your posts when you publish them, and promote them on your Twitter account. You'll like the plugin even if you're not running your own YOURLS as it's also designed to work with tr.im, bit.ly, is.gd and tinyurl.com for maximum fun.

Get YOURLS, then get the plugin: YOURLS: WordPress to Twitter

Shorter URL

Want to share or tweet this post? Please use this short URL: http://ozh.in/m8

Metastuff

This entry "Introducing YOURLS (Your Own URL Shortener) and its WordPress Plugin Companion" was posted on 25/06/2009 at 10:56 pm and is tagged with , , ,
Watch this discussion : Comments RSS 2.0.

39 Blablas

  1. koutsou says:

    Thanks a lot for your job! Even more that all of yours work is free.
    I'm going to install in my own site!

  2. marcO says:

    Nice one! Definetly will give it a try!

  3. Derek S says:

    Been testing this out religiously, found an issue, post to the Google Code page.

  4. Derek S says:

    Is there any way I could become a member of the project?

  5. Ozh says:

    Derek S » Reported issue should be fixed

  6. Elpie says:

    Nice work Ozh.
    I am really looking forward to using the WordPress plugin and set up yourls on my new shorturl domain. BUT, I am not getting a redirection to the real URL.
    I've documented the issue on the tracker.

    Hope you can help

  7. moggy says:

    @Elpie

    Open yourls-go.php and delete the contents of line #23:

    1. var_dump($url); die();

    Once that's gone the redirect should start working again.

  8. What's the best place to get support? Also: is there a place to donate for Yourls? No, that isn't a douchey attempt to bribe for service. I do actually donate to lots of projects like this. :D

    If you're fielding questions here: I can't get domains to resolve. Yourls set up great on DreamHost, and I can create domains, but none of them resolve; they're all 404 errors. http://davebc.net/1 should resolve to a Realmac Software page. It also isn't registering clicks; I had around 15 or so replies on Twitter that the domain isn't resolving, but my dashboard says the link has had 0 clicks so far.

    I know this is probably a little broad, but might you have any ideas on what's going wrong?

    Thanks so much.

  9. Ozh says:

    Dave Chartier » is mod_rewrite enabled? Mostly it's a mod_rewrite or .htaccess error

  10. Heiko says:

    I can't find information how the .htaccess have to look like. and also the installation didn't create a file. any tips? ;)

  11. Ozh says:

    Heiko » the YOURLS package contains a .htaccess file, it's all you need

  12. jarbro says:

    Whenever I try and pass something to the API I always get the following error:

    Missing parameter "action"

  13. Ozh says:

    jarbro » ow yeah my bad, I forgot to update the api-sample file when I introduced this. You need to add action=shorturl for instance. Look in file yourls-api.php

  14. Heiko says:

    Ozh » Thanks, my Mac didn't showed the file because of the point in front of the filename…

    But i find a real bug. if you enter a url with conatains "http://" twice, YOURLS don't save the first "http://". try it yourself with "http://ad.zanox.com/ppc/?12545695C1170483212T&ULP=[[http://www.fotokasten.de/index.php?ftkPage=categories&category=55&source=de_zanox]]&SIDE=[[sem-fototasse]]". If i edit the url directly in the database evertyhing is fine.

  15. Seth Long says:

    Ozh – Great app! One question, though: Is there a bookmarklet version available, either officially or from a contributor? Love the WP plugin, too.

  16. jarbro says:

    Yeah, I figured that out after I posted here by looking at the code on your wordpress-plugin where you pass variables to the api.

    Now I have a bookmarklet and a hacked together Firefox plugin using yourls!

  17. jarbro says:

    I noticed a bunch of people are looking for bookmarklets for YOURLS, so I created a script to do just that. You can grab it @ http://jarb.ro/M

    Installation instructions are included in the package.

    Enjoy!

  18. Seth Long says:

    Works beautifully! Thanks, jarbo.

  19. Ozh says:

    Heiko » Nice catch, I'll work on this.

  20. […] plugin that can automate the creation of Yourl-generated short links for each and every post, and a bookmarklet generator for those who don't want to head back to their own site to create new short […]

  21. Aaron says:

    I followed Lifehacker's step-by-step on this, and all I end up with is an Error 500. I have yourls in a subfolder (named yourls), and I've checked all my database info multiple times, but I'm stuck with nothing. Could I get an example of how the .htaccess file should be modified so I know I haven't screwed that up?

  22. dto510 says:

    This is the very first PHP script that I've ever installed manually, and it works great – thank you so much! I had an issue with the .htaccess file because I use a Mac, and if I had overridden the existing .htaccess file in the first domain directory I tried, it would have been a big problem. Maybe you should add a warning to Mac users / inexperienced users (I didn't know what a .htaccess file was until I was installing this application, and I'm not a complete novice)?

    Thanks again for this great application! My Twitter friends will be so jealous.

  23. Ozh says:

    Aaron » The .htaccess file is like so:
    http://code.google.com/p/yourls/source/browse/trunk/.htaccess
    Try modifying line 6 with the absolute path to your subfolder:
    RewriteRule ^([0-9A-Za-z]+)/?$ /path/to/yourls-go.php?id=$1 [L]

  24. Chris says:

    Hi Ozh,

    I installed Yourls and really like it so far.

    Just a question, I am concerned about privacy. If I choose to make the install publicly available then anyone can see anyone else's shortened URLs. Ok that might be cool, but I think only the site owner should be able to see IP addresses. That way I could block a spammer or find all links created by a spammer, etc.

    What do you think?

    Thanks..

    Chris
    http://www.edurls.org

  25. Ozh says:

    Chris » Or leave it as PRIVATE but use a front page as the sample provided. This way, everybody can create short URLs, but only admin(s) can see IPs and stuff

  26. Chris says:

    If I leave it private, can folks see their own URLs?

    I was hoping to allow folks to see their own shortened links (a la bit.ly) with link statistics, etc.

    Thanks.

    Chris

  27. Ozh says:

    Chris » At the moment I don't plan to make YOURLS multi-user like this

  28. Doug Stewart says:

    Ozh:
    Does the plugin run a check for whether the rich text editor is enabled? I disable it by default and it gets hosed if I enable the YOURLs plugin. If I go to my account and enable rich text editing, everything returns to working order.

  29. Doug Stewart says:

    Here's what Firebug's console reports:

    jQuery("#titlewrap #title").val() is undefined
    http://literalbarrage.org/blog/wp-content/plugins/yourls-wordpress-to-twitter/res/post.js?ver=2.8.4
    Line 14

  30. Ozh says:

    Doug Stewart » definitely works with me. Or does this happen on a page that not "New Post" or "New Page"?

  31. Thanks a lot for the bookmarklet….
    gazallions of thanks
    :D

    -Mahmud (Mohammad Mahmud Kabir)
    http://www.MahmudKabir.com
    Twitter: @mahmudkabir

  32. Doug Stewart says:

    Ozh:
    This occurs on Edit Post pages. I've not tried out Pages yet.

  33. Doug Stewart says:

    Okay, just tried the same thing (with the same results) on Pages. New Page — no problem. Edit Page — problem.

    Also, I think the RTE behavior I was seeing was a red herring or a caching issue. The problem now occurs regardless of whether I have RTE on or off.

    Browsers are FF 3.5.2 and Camino 1.6.8 on OS X 10.5.8, btw. Haven't attempted Safari yet.

  34. Doug Stewart says:

    A "View Source" of the page shows output dying on the right-hand widget for the YOURLs plugin. This is the last output you get on the page:

    Short URL & Tweet

  35. Doug Stewart says:

    Gah, it ate my formatting.

    Here's another try:

    1. Short URL & Tweet

    /me crosses fingers.

  36. brahm says:

    @jarbro – thanks for the bookmarklet script! Works perfectly :)

  37. Doug Stewart says:

    Aha! Think I found the problem. With WP_DEBUG set to true, the following gets logged in the WP YOURLs Edit Post screen widget:

    1. Fatal error: Cannot redeclare class Services_JSON in (file path)/literalbarrage.org/blog/wp-content/plugins/yourls-wordpress-to-twitter/inc/pear_json.php on line 116

    I think it's a conflict with Alex King's Twitter Tools, although Intense Debate, Meet Your Commenters and Woopra all define it as well.

  38. Doug Stewart says:

    Yup, disabling Twitter Tools and a reload of the Edit Post page confirms that it's a namespacing issue between TT and YOURLs.

    Help me, Ozh-y Wan Kenobi!

  39. Ozh says:

    Doug Stewart » Doh, that's a stupid error indeed :) Thanks for report, I'll update the plugin probably this week-end (I have a few stuff to throw in)

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>
Gravatars: Curious about the little images next to each commenter's name ? Go to Gravatar and sign for a free account
Spam: Various spam plugins may be activated. I'll put pins in a Voodoo doll if you spam me.

Read more ?