where("name", "=", $tag_name)->find(); if (!$tag->loaded()) { // No matching tag was found. If this was an imported tag, this is probably a bug. // If the user typed the URL manually, it might just be wrong throw new Kohana_404_Exception(); } url::redirect($tag->abs_url()); } }