Zend certified PHP/Magento developer

Multiple Store URL

guys.
I’ve spent more than a week to solve the problem with URL’s in my Multiple Stores in Magento Community 2.3.2, but I got nothing.

What I need:
URL structure:
example.com/store_name/store_viewname
instead of typical
example.com/store_viewname offered by Magento 2 with “Add Store Code to Urls” activated.

What I’ve done:
1) Created Website – Store – Store View.
2) Added individual Secured and Non-secured Base URL and Base Link URL for each store like: http://example.com/store_name/ and https://example.com/store_name/
3) Pointed proper CMS Home page in Default pages
4) Created subfolder with index.php and .htaccess with modifications:

require DIR . ‘/app/bootstrap.php’; #tried /../app/ also
$params = $_SERVER;
$params[MagentoStoreModelStoreManager::PARAM_RUN_CODE] = ‘store_viewname’;
$params[MagentoStoreModelStoreManager::PARAM_RUN_TYPE] = ‘store’;
$bootstrap = MagentoFrameworkAppBootstrap::create(BP, $params);
/** @var MagentoFrameworkAppHttp $app */
$app = $bootstrap->createApplication(MagentoFrameworkAppHttp::class);
$bootstrap->run($app);

and .htaccess below RewriteEngine = On:
SetEnvIf Host www.example.com/store_name MAGE_RUN_CODE=store_viewname
SetEnvIf Host www.example.com/store_name MAGE_RUN_TYPE=store
SetEnvIf Host ^example.com/store_name MAGE_RUN_CODE=store_viewname
SetEnvIf Host ^megamolis.ru/store_name MAGE_RUN_TYPE=store

RewriteCond %{REQUEST_URI} ^/store_name/.* [NC,OR]
RewriteCond %{REQUEST_URI} ^/store_name$ [NC]
RewriteRule .* – [E=MAGE_RUN_CODE:store_viewname]
RewriteCond %{ENV:REDIRECT_MAGE_RUN_CODE} (.+)
RewriteRule .* – [E=MAGE_RUN_CODE:%1,E=MAGE_RUN_TYPE:store]`

Of course, Cache Flashed and php bin/magento setup:static-content:deploy -f after changes. And symlinks of app, pub, lib, var added to the subfolder.
Moreover, I tried to create subfolders both in example.com and example.com/pub for checking.

What I’ve got:

example.com/store_name

Whoops, our bad…
The page you requested was not found, and we have a fine guess why.
If you typed the URL directly, please make sure the spelling is correct.
If you clicked on a link to get here, the link is outdated.

It seems 404.

This error designed in the style of Magento. example.com/static and example.com/media work in design of DEFAULT store. Because I added the path (Base URLs) to example.com/static/ and example.com/media/ in Store Config.

example.com/store_name/store_viewname has the same result

And if I try to change the store to default it redirects to https://example.com/store_name/store_viewname/stores/store/redirect/ instead of example.com

example.com works perfectly.
I need your help. Thank you.