adding a rewrite rule in wordpress functions file

Did you add the query vars via the query_vars-hook in addition to the defintion of the rewrite rule in the init-hook?

add_filter( 'query_vars', 'my_add_query_var_function' );
function my_add_query_var_function( $vars ) {
    $vars[] = 'a';
    $vars[] = 'cat';
    $vars[] = 'where';
    return $vars;
}