In: , , ,
On: 2009 / 06 / 25 Viewed: 63324 times
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. 1
    koutsou Greece »
    thought, on 26/Jun/09 at 1:32 am # :

    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. 2
    marcO Germany »
    commented, on 26/Jun/09 at 5:56 am # :

    Nice one! Definetly will give it a try!

  3. 3
    Derek S United States »
    said, on 30/Jun/09 at 5:58 pm # :

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

  4. 4
    Derek S United States »
    said, on 30/Jun/09 at 6:27 pm # :

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

  5. 5
    Ozh France »
    replied, on 30/Jun/09 at 10:39 pm # :

    Derek S » Reported issue should be fixed

  6. 6
    Elpie New Zealand (Aotearoa) »
    said, on 05/Jul/09 at 2:02 pm # :

    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. 7
    moggy United States »
    thought, on 07/Jul/09 at 1:31 am # :

    @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. 8
    Dave Chartier United States »
    replied, on 11/Aug/09 at 4:57 am # :

    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. 9
    Ozh France »
    said, on 11/Aug/09 at 8:47 am # :

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

  10. 10
    Heiko Germany »
    thought, on 11/Aug/09 at 10:23 pm # :

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

  11. 11
    Ozh France »
    wrote, on 11/Aug/09 at 10:54 pm # :

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

  12. 12
    jarbro United States »
    commented, on 11/Aug/09 at 11:37 pm # :

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

    Missing parameter "action"

  13. 13
    Ozh France »
    thought, on 12/Aug/09 at 7:49 am # :

    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. 14
    Heiko Germany »
    commented, on 12/Aug/09 at 8:21 am # :

    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. 15
    Seth Long United States »
    commented, on 12/Aug/09 at 3:33 pm # :

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

  16. 16
    jarbro United States »
    replied, on 12/Aug/09 at 9:30 pm # :

    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. 17
    jarbro United States »
    said, on 13/Aug/09 at 12:47 am # :

    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. 18
    Seth Long United States »
    said, on 13/Aug/09 at 4:53 am # :

    Works beautifully! Thanks, jarbo.

  19. 19
    Ozh France »
    wrote, on 13/Aug/09 at 8:38 am # :

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

  20. 20
    Make Your Own URL Shortening Service | L... Australia »
    pingback on 15/Aug/09 at 2:09 am # :

    [...] 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. 21
    Aaron United States »
    thought, on 16/Aug/09 at 9:51 pm # :

    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. 22
    dto510 United States »
    commented, on 17/Aug/09 at 4:09 am # :

    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. 23
    Ozh France »
    thought, on 17/Aug/09 at 8:21 am # :

    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. 24
    Chris United States »
    commented, on 19/Aug/09 at 2:24 am # :

    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. 25
    Ozh France »
    commented, on 19/Aug/09 at 10:56 am # :

    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. 26
    Chris United States »
    wrote, on 19/Aug/09 at 11:25 am # :

    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. 27
    Ozh France »
    said, on 19/Aug/09 at 11:48 pm # :

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

  28. 28
    Doug Stewart United States »
    thought, on 20/Aug/09 at 12:33 am # :

    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. 29
    Doug Stewart United States »
    replied, on 20/Aug/09 at 12:37 am # :

    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. 30
    Ozh France »
    wrote, on 20/Aug/09 at 12:46 am # :

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

  31. 31
    Mohammad Mahmud Kabir Bangladesh »
    replied, on 20/Aug/09 at 2:28 am # :

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

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

  32. 32
    Doug Stewart United States »
    said, on 20/Aug/09 at 3:35 am # :

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

  33. 33
    Doug Stewart United States »
    commented, on 20/Aug/09 at 4:29 am # :

    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. 34
    Doug Stewart United States »
    said, on 20/Aug/09 at 4:39 am # :

    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. 35
    Doug Stewart United States »
    thought, on 20/Aug/09 at 4:40 am # :

    Gah, it ate my formatting.

    Here's another try:

    1. Short URL & Tweet

    /me crosses fingers.

  36. 36
    brahm Canada »
    wrote, on 20/Aug/09 at 8:52 pm # :

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

  37. 37
    Doug Stewart United States »
    wrote, on 21/Aug/09 at 2:26 pm # :

    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. 38
    Doug Stewart United States »
    replied, on 21/Aug/09 at 2:29 pm # :

    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. 39
    Ozh France »
    replied, on 21/Aug/09 at 4:59 pm # :

    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

Comment Guidelines or Die

  • HTML: You can use these tags: <a href=""> <em> <i> <b> <strong> <blockquote>
  • Posting code: Post raw code (no <> &lt; etc) within appropriate tags : [php][/php], [css][/css], [html][/html], [js][/js], [sql][/sql], [xml][/xml], or generic [code][code]
  • Gravatars: Curious about the little images next to each commenter's name ? Go to Gravatar.
  • Spam: Various spam plugins on patrol. I'll put pins in a Voodoo doll if you spam me.
  • I will mark as Spam test comments, all comments with SEO names (ie "My Cool Online Shop" instead of "Joe") or containing forum-like signatures.

Read more ?