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.
Our 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
Thanks a lot for your job! Even more that all of yours work is free.
I'm going to install in my own site!
Nice one! Definetly will give it a try!
Been testing this out religiously, found an issue, post to the Google Code page.
Is there any way I could become a member of the project?
Derek S » Reported issue should be fixed
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
@Elpie
Open yourls-go.php and delete the contents of line #23:
Once that's gone the redirect should start working again.
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.
Dave Chartier » is mod_rewrite enabled? Mostly it's a mod_rewrite or .htaccess error
I can't find information how the .htaccess have to look like. and also the installation didn't create a file. any tips? ;)
Heiko » the YOURLS package contains a .htaccess file, it's all you need
Whenever I try and pass something to the API I always get the following error:
Missing parameter "action"
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
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.
Ozh – Great app! One question, though: Is there a bookmarklet version available, either officially or from a contributor? Love the WP plugin, too.
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!
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!
Works beautifully! Thanks, jarbo.
Heiko » Nice catch, I'll work on this.
[…] 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 […]
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?
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.
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]
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
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
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
Chris » At the moment I don't plan to make YOURLS multi-user like this
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.
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
Doug Stewart » definitely works with me. Or does this happen on a page that not "New Post" or "New Page"?
Thanks a lot for the bookmarklet….
gazallions of thanks
:D
-Mahmud (Mohammad Mahmud Kabir)
http://www.MahmudKabir.com
Twitter: @mahmudkabir
Ozh:
This occurs on Edit Post pages. I've not tried out Pages yet.
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.
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
Gah, it ate my formatting.
Here's another try:
/me crosses fingers.
@jarbro – thanks for the bookmarklet script! Works perfectly :)
Aha! Think I found the problem. With WP_DEBUG set to true, the following gets logged in the WP YOURLs Edit Post screen widget:
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.
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!
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)