Problems Implementing Non-WordPress Rewrite Rules

Here’s a solution to the problem. Not sure it’s the best one, but it does work. From lots of reading and a bit of poking around in the wordpress core (code), it seems that non_wp rewrite rules only work on Apache. DevKinsta is Nginx-based, and there’s precious little out there at this deep level on any of the tech blogs, stackExchange, or stackOverflow.

Anyway, I ditched all the previous rewrite code and used the following instead:

//catch "/contact/", "/customers/", and "/team/" in the URL and pull content from the built-in templates
function templates_callback( $original_template ) {
    $theme_name = next(explode('/themes/', get_stylesheet_directory()));
    $url = $_SERVER['REQUEST_URI'];
    //FIXME the logic below needs to be extended to check for the dropdown setting of each page
    //in the themes setting page. If the setting is default, return the template as configured 
    //below. If there's another page selected, return that page instead
    if (preg_match('/\/team\//',$url)) {
        return 'wp-content/themes/'. $theme_name . '/page-templates/team.php';
    }elseif(preg_match('/\/contact\//',$url)){
        return 'wp-content/themes/'. $theme_name . '/page-templates/contact.php';
    }elseif(preg_match('/\/customers\//',$url)){
        return 'wp-content/themes/'. $theme_name . '/page-templates/customers.php';
    }else {
        return $original_template;
    }
}
add_filter( 'template_include', 'templates_callback' );