Sometimes I wonder… why do I do such things?
Well, honestly I am a megalomaniac, and all the most famous websites have an URL shortening service for their own service. Since (one day) FoOlRulez will be the biggest website evar, I thought… why not adding the short URL service early? Doing it was far harder than thinking of it.
You know, we aren’t using a LAMP (Linux-Apache-MySQL-PHP) server, but an Nginx powered server (LNMP sounds gay tho). This means most of the software needs some fix to work correctly, though it will work much faster. This means YOURLS, the software I intended to use, needed some fix as well.
For this fix, I had to find a solution, and I have found it here: 使用 Yourls 强化你的短网址系统 – Showfom’s Blog.
I have no idea what that URL says… but hey, I found the fix to make YOURLS work!
if (!-f $request_filename){
set $rule_0 1$rule_0;
}
if (!-d $request_filename){
set $rule_0 2$rule_0;
}
if ($rule_0 = "21"){
rewrite ^/([0-9a-z]+)/?$ /yourls-go.php?id=$1 last;
}
Gibberish? No this is the code you need to make it work in your Nginx installation! Paste it where you need it. If you don’t know how comment here and I’ll explain a bit further.
Anyway, this made everything work… a bit of styling of the homepage et voilà!
It works! I can’t believe it myself!
Let’s go a bit more indeep with YOURLS. This is a very complete script to make your own URL shortener, by:
I think they’re the same who made a few of the plugins I use in this Wordpress blog (yeah they are). Anyway, this script is powerful enough to not leave you dry mouthed: you get an API to use the URL shortening service on your server from anywhere, the admin menu lets you control the tidbits you need (ok, most of the controls are via code, but it’s easily done with the explanations), the code has explanation for most of the lines – I in fact edited it to fit my needs better.
Best part of all, it comes with a Wordpress plugin, that hooks to the shortening service and makes a short url for every post: even this one post has a shortening url. Then you get automatic submission of the post to Twitter after publishing. The button to submit to twitter on the top is my creation by using the functions (wordpress hooks) that YOURL for Wordpress provides.
@gamerz @ozh Thanks for YOURLS =) “FoOlz.us and how to make YOURLS work with Nginx.” http://foolrulez.org/blog/2009/08/foolz-...
via Twitoaster
@woxxy Awesome! I’m adding this to the readme. Stay tuned, next version has link stats & more :)
via Twitoaster
@woxxy no problem =D
via Twitoaster
I love it woxxy.
Keep up the good work.
PS:
http://foolz.us/a = /a/
http://foolz.us/b = /b/
:3
The URL you linked above says “Use your short-Yourls enhanced web-based system – Showfom’s Blog.” /google translated =P
So this is basically like Tinyurl/bit.ly huh?
Lol, thanks for the auto-translation Nyarth.
And yeah, that’s exactly what it does.
Oh hey, this is pretty cool.
Once the database “registers” a custom keyword, does it expire after a while?
Or is it permanently stored?
It’s permanent. More precisely, as long as FoOlRulez exists.
Whoa that’s the awesome.
What? DickensUrl wasn’t good enough for you?
FoOls: http://dickensurl.com/bf68/*an immensely long url*
Oh, shoot, I broke the blog. Sorry D:
lol you keep breaking stuff.
This is pretty cool.
Haha so you use Nginx, too. I love it~
Ok, I don’t know where to put the code above. Please help. Thanks!
[...] the site for YOURLS there’s a link for nginx rewrites however it has 3 [...]