force category base – archive pages work WITH & WITHOUT category base slug in url?

I found a solution here: 404 on category.php pagination

So, to fix my issue I just needed to add these custom rewrite rules to functions.php:

add_action( 'init', 'wpa58471_category_base' );
function wpa58471_category_base() {
    add_rewrite_rule(
        'blog/([^/]+)/page/(\d+)/?$',
        'index.php?category_name=$matches[1]&paged=$matches[2]',
        'top' 
    );
    add_rewrite_rule( 
        'blog/([^/]+)/(feed|rdf|rss|rss2|atom)/?$',
        'index.php?category_name=$matches[1]&feed=$matches[2]', 
        'top' 
    );
}

Now, all blog pages work, including main blog page, archives, categories, and single posts, using the permalink custom structure of /blog/%category/%postname%

**ALSO, if using Yoast, make sure you “Keep” the category base (this is the default under advanced->permalinks)