News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Jonathan Snook's Blog:
Building a URL Shortener (with CakePHP)
April 27, 2009 @ 12:06:23

With recent discussions about URL shortners, Jonathan Snook decided to work up his own quick version using some of the built-in routing of the CakePHP framework.

With all the talk of URL shortening services, I decided to add a quick service into Snook.ca, which is run on CakePHP, to redirect a short URL to a post. Because my static content already has short URLs and all I have are posts, creating a short URL handler for it was very easy.

His shortener is used on his posts for his blog to redirect the smaller URLs back to the post they reference. The result is a route that connects something like "/s/id_number" over to the correct post (as seen here). He also offers a suggestion for a "super-compressed" URL tat converts it down to a three-character shortened version that can then be easily converted back down to the decimal equivalent.

3 comments voice your opinion now!
cakephp framework url shortener short route custom


blog comments powered by Disqus

Similar Posts

Jonathan Snook's Blog: CakePHP, is it worth it?

Samantha Quinones: Project Laravel - Session 1: First impressions

Frank Wu's Blog: Choosing a PHP Framework Round 2: Yii vs Kohana vs CodeIgniter

HHVM.com: Wow HHVM is fast...too bad it doesn’t run my code

7PHP.com: Zend Certifications Tips & Tricks - Michelangelo van Dam


Community Events





Don't see your event here?
Let us know!


introduction zendserver voicesoftheelephpant bugfix series release tips api framework podcast laravel symfony code threedevsandamaybe conference community interview list language deployment

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework