Skip to content

Instantly share code, notes, and snippets.

@sineld
Created November 5, 2012 07:00
Show Gist options
  • Select an option

  • Save sineld/4015717 to your computer and use it in GitHub Desktop.

Select an option

Save sineld/4015717 to your computer and use it in GitHub Desktop.
Twitter username style urls: twitter.com/sineld
<?php
// Source: http://www.everyonecanweb.com/snippet/view/28
Route::filter('before', function()
{
// Direct user to clouddueling.com/nickname
$nickname = URI::segment( 1 );
if( !in_array( $nickname, Controller::detect() ) )
{
$user = User::where_nickname( $nickname )->first();
if( !is_null( $user ) )
return Controller::call( 'user@profile', array( $user->id ) );
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment