Wp Rewrite pagination for custom taxonomy and custom post type url

function custom_rewrite_basic( $wp_rewrite ) {
    $feed_rules = array(
        '([^/]+)/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?demand=$matches[1]&location=$matches[2]&paged=$matches[3]',
        '([^/]+)/([^/]+)/?$' => 'index.php?demand=$matches[1]&location=$matches[2]',
    );

    $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
    return $wp_rewrite->rules;
}

add_filter( 'generate_rewrite_rules', 'custom_rewrite_basic' );