Multi Store RewriteBase Problem (Magento 2.3)

Sophia: 20 May 2022

I am trying to set up a Magento 2.3 CE multi store installation. Most things are working fine:

Default website and magento admin are available on (/admin_sdgshgd).

I created another website + store view + store and set the base urls to Apache 2 config has been updated and seems to be working fine.

Now to the problem:

The default website ( is referencing styles and js with /pub/static/*, so I had to set the RewriteBase to /public/static/ in the .htaccess file in the static folder.

The new website ( is using /static/ (without /pub) - so this store works if I change RewriteBase to /static/.

That means, I can have either default and admin, or the new store working correctly, but not both.

I have no clue why the urls are with or without pub on the one hand and I have no idea either, how I could make both sites run correctly while they have different paths.

Here are the vhost configs:

  <VirtualHost *:443>
    DocumentRoot /var/www/vhosts/b/httpdocs

    ErrorLog ${APACHE_LOG_DIR}/error-magento.log
    CustomLog ${APACHE_LOG_DIR}/access-magento.log combined

    RewriteEngine On

    Include /etc/letsencrypt/options-ssl-apache.conf
    SSLCertificateFile /etc/letsencrypt/live/b/fullchain.pem
    SSLCertificateKeyFile /etc/letsencrypt/live/b/privkey.pem

<VirtualHost *:443>
   DocumentRoot        /var/www/vhosts/b/httpdocs

   ErrorLog ${APACHE_LOG_DIR}/error-c.log
   CustomLog ${APACHE_LOG_DIR}/access-c.log combined

   RewriteEngine On

   SetEnv MAGE_RUN_CODE "postelhq"
   SetEnv MAGE_RUN_TYPE "website"
   SSLCertificateFile /etc/letsencrypt/live/b/fullchain.pem
   SSLCertificateKeyFile /etc/letsencrypt/live/b/privkey.pem
   Include /etc/letsencrypt/options-ssl-apache.conf

And that's the .htaccess excerpt:

<IfModule mod_rewrite.c>
    RewriteEngine On

    ## you can put here your pub/static folder path relative to web root
    RewriteBase /pub/static/  # works with
    #Rewritebase /static/ # works with

    # Remove signature of the static files that is used to overcome the browser cache
    RewriteRule ^version.+?/(.+)$ $1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-l

    RewriteRule .* ../static.php?resource=$0 [L]
    # Detects if moxieplayer request with uri params and redirects to uri without params
    <Files moxieplayer.swf>
        RewriteCond %{QUERY_STRING} !^$
        RewriteRule ^(.*)$ %{REQUEST_URI}? [R=301,L]


Any ideas what could have gone wrong? Thanks, OG

Grace: 20 May 2022

Got the solution, but I don't know why.. With the second domain, I had to add pub/ at then end of the base urls.