WordPress rewrite question

Here’s an endpoint solution as mentioned in my comment. First, add the endpoint by adding this code to your theme’s functions.php file:

function wpa_add_rep_endpoint(){
    add_rewrite_endpoint( 'rep', EP_ROOT );
}
add_action( 'init', 'wpa_add_rep_endpoint' );

Then visit the Settings > Permalinks page in admin after adding the endpoint to flush the rewrite rules so this endpoint will take effect.

Now, within your template you’ll be able to access the value of rep with get_query_var():

$requested_rep = get_query_var( 'rep' );

EDIT

Here’s another option that you can use to check if a 404 is a request for one of your reps. We hook the template_redirect action which runs after the database is queried and see if is_404(). You can insert your code to query your own table for a matching rep name here. If it passes your test, send on OK status header, and load your template that displays a rep. It’s a bit hacky, but it should work-

function wpa_check_rep(){
    if( is_404() ){
        global $wp_query;

        // this will contain the potential rep name
        // if the request matches the page rewrite pattern
        $request = $wp_query->query['pagename'];

        $is_valid_rep_name = false;
        // your code to check if $request is a valid rep name here
        // if it is a valid rep name, make WP send a 200 instead of 404
        // and load your desired template
        if( true === $is_valid_rep_name ){
            status_header( '200' );
            $wp_query->is_404 = null;
            include( get_template_directory() . '/rep-template.php' );
            exit();
        }
    }
}
add_action( 'template_redirect', 'wpa_check_rep' );