How do I prefix blog post urls as but allow authors to still be located at

I’ve tried a bunch of things but cannot find a solution that works.

I want my site to have the structure: = homepage = blog archive = blog archive (in a specific year) = blog archive (in a specific month) = blog post = authors archive = author profile = custom post type archive = custom post type post

Currently, with /blogs/%year%/%month%/%postname%/ set as the permalink structure, everything works correctly except the authors part. It forces it to and, which is not desireable, since most authors will be making custom post types and not blogs.

Some posts I checked here but without the right answer:

How to properly prefix blog post URL's

Permalinks Question: Adding a prefix ONLY in front of the posts

Possible to change the URL for the regular post type without affecting the URL of other custom post types?

Solutions Collecting From Web of "How do I prefix blog post urls as but allow authors to still be located at"

You can set the author base independently by manipulating the $wp_rewrite global:

function wpa55976_author_base() {
    global $wp_rewrite;
    $wp_rewrite->author_base = 'authors';
    $wp_rewrite->author_structure = '/' . $wp_rewrite->author_base . '/%author%';

    // EDIT - rewrite rule to force author urls to resolve:
    add_rewrite_rule('authors/([^/]+)/?$', 'index.php?author_name=$matches[1]', 'top');

add_action( 'init', 'wpa55976_author_base' );

Make sure to visit your permalinks page to flush rewrites after you add this.

The one thing you won’t get is = authors archive, as WordPress doesn’t provide this page by default, though you may be able to create an authors page and use a custom template, or add a rewrite rule to handle it.