November 16, 2004

Flickr like url styling.

There has been some talk lately about Flickr's url structure. Specifically, presenting a url like so:

Instead of


Instead of:

You get the point. So many developers don't do this, but the nice thing is that, intrepid developers, you can do this in practically any language very easily. If you haven't tried it, you can pull it right out of script name.

Apache does some magic with this. For instance. If you go to this url :

Then you'll see a little php script that prints out the script name.

But look what happens when you go here:

Here is the super simple code for that page:

$urisplit = split("/",$_SERVER['REQUEST_URI']);
$name= $urisplit[count($urisplit)-1];
print "Hi There $name !<p>";
print "Request URI = {$_SERVER['REQUEST_URI']}";

An exercise for you, my reader. Have it do multiple tagging, for instance, give a result like "Hi There Chris and Bob" or something.

Chris DiBona
Posting From: Mountain View, Ca
Posting Via: Blogger Interface


Kona said...

Now we have to know php code to enjoy your site. I'm just a dumb system admin who does not code, but is a nice trick to shorten url. But I use

Chris DiBona said...

you can skip this post then :-) They won't all be code filled.


James Byers said...

There's one thing to watch out for if you're running Apache. Apache 1.3 works fine out of the box for URLs like:


However, in Apache 2.0, you must set the configuration directive AcceptPathInfo to On. Otherwise, Apache will return a 404.