Multistore redirection not working as it should



  • hello guys!
    I’ve got a multistore setup with everything in an Ubuntu VM with apache 2.
    Thirtybees migrated from prestashop 1.7, and was working fine untill I decided to tackle a thing that boggled me a bit.
    So, everything is correctly configured in the vhosts, with both of them pointing to the same root directory, where the installation of TB is.
    siteA.com with alias www.siteA.com works fine.
    siteB.com with alias www.siteB.com doesn’t work so fine.

    siteB.com and www.siteB.com will always redirect to siteA.com
    even though its vhost is ok, which I can be sure of the momment I go to siteB.com/[thirtybeesAdminDirectory]

    siteB.com will work when I make it reside in a virtual directory , for example

    siteB.com/store

    but if I enter

    www.siteB.com/store

    it doesn’t work, again.
    Redirects to siteA.com

    what I would like is to make siteB.com and www.siteB.com to open the store right away, or redirect to siteB.com/store , and open the second store, not redirect to siteA.com , which is the first store.

    What could cause this?



  • Hello again!
    Here’s an update. Finally got it to BARELY work.
    Currently:

    siteA.com POINTS TO siteA.com
    www.siteA.com POINTS TO siteA.com

    siteB.com POINTS TO siteB.com
    www.siteB.com POINTS TO siteA.com

    A bit more in-depth now:
    The stores are hosted on the same server, and ssl is granted by letsencrypt’s certbot.

    apache2 vhosts.com.conf and vhosts.com-le-ssl.conf point to the same var/www/site/public_html folder, where the installation is.
    The htaccess is more or less this:

    <IfModule mod_rewrite.c>
        <IfModule mod_env.c>
        SetEnv HTTP_MOD_REWRITE On
        </IfModule>
     
        RewriteEngine on
        #Domain: siteA.com
        #RewriteRule . - [E=REWRITEBASE:/]
        RewriteRule ^api$ api/ [L]
     
        RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]
    
    # Dispatcher
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteCond %{HTTP_HOST} ^siteA.com$
    RewriteRule ^.*$ - [NC,L]
    RewriteCond %{HTTP_HOST} ^siteA.com$
    RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
     
     
    #Domain: siteB.com
    RewriteCond %{HTTP_HOST} ^siteB.com$
    RewriteRule . - [E=REWRITEBASE:/]
    RewriteRule ^api$ api/ [L]
     
    RewriteRule ^api/(.*)$ %{ENV:REWRITEBASE}webservice/dispatcher.php?url=$1 [QSA,L]
     
    RewriteCond %{HTTP_HOST} ^siteB.com$
    RewriteRule ^loja$ /loja/ [L,R]
    RewriteCond %{HTTP_HOST} ^siteB.com$
    RewriteRule ^loja/(.*) /$1 [L]
    # Dispatcher
    RewriteCond %{REQUEST_FILENAME} -s [OR]
    RewriteCond %{REQUEST_FILENAME} -l [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteCond %{HTTP_HOST} ^siteB.com$
    RewriteRule ^.*$ - [NC,L]
    RewriteCond %{HTTP_HOST} ^siteB.com$
    RewriteRule ^.*$ %{ENV:REWRITEBASE}index.php [NC,L]
    </IfModule>
     
    AddType application/vnd.ms-fontobject .eot
    AddType font/ttf .ttf
    AddType font/otf .otf
    AddType application/font-woff .woff
    AddType application/font-woff2 .woff2
    <IfModule mod_headers.c>
        <FilesMatch "\.(ttf|ttc|otf|eot|woff|woff2|svg)$">
            Header add Access-Control-Allow-Origin "*"
        </FilesMatch>
    </IfModule>
    
      <IfModule mod_expires.c>
            ExpiresActive On
            ExpiresByType image/gif "access plus 1 month"
            ExpiresByType image/jpeg "access plus 1 month"
            ExpiresByType image/png "access plus 1 month"
            ExpiresByType text/css "access plus 1 week"
            ExpiresByType text/javascript "access plus 1 week"
        ExpiresByType application/x-javascript "access plus 1 week"
        ExpiresByType image/x-icon "access plus 1 year"
        ExpiresByType image/svg+xml "access plus 1 year"
        ExpiresByType image/vnd.microsoft.icon "access plus 1 year"
        ExpiresByType application/font-woff "access plus 1 year"
        ExpiresByType application/font-woff2 "access plus 1 year"
        ExpiresByType application/x-font-woff "access plus 1 year"
        ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
        ExpiresByType font/opentype "access plus 1 year"
        ExpiresByType font/ttf "access plus 1 year"
        ExpiresByType font/otf "access plus 1 year"
        ExpiresByType application/x-font-ttf "access plus 1 year"
        ExpiresByType application/x-font-otf "access plus 1 year"
    </IfModule>
     
    <IfModule mod_headers.c>
        Header unset Etag
    </IfModule>
    FileETag none
    <IfModule mod_deflate.c>
        <IfModule mod_filter.c>
            AddOutputFilterByType DEFLATE text/html text/css text/javascript application/javascript application/x-javascript font/ttf application/x-font-ttf font/otf application/x-font-otf font/opentype image/svg+xml
        </IfModule>
    </IfModule>
     
    #If rewrite mod isn't enabled
    ErrorDocument 404 /index.php?controller=404
    
    
    # ~~end~~ Do not remove this comment, thirty bees will keep automatically the code outside this comment when .htaccess will be generated again
    


  • I’m posting here is just to notify you guys that this forum has not been nearly helpfull enough.
    Why has nobody answered my thread?
    How can I get my job done?



  • you dont have to yell in your topic name



  • Would just adding a simple redirect at the top of the htaccess fix this issue?

    siteB.com POINTS TO siteB.com
    www.siteB.com POINTS TO siteA.com



  • you dont have to yell in your topic name

    True. Relaxed this a bit.



  • I’m missing a description of the multistore setup here. Having one shop installation gives one shop, even if one defines more than one URLs to access it. Redirection to the main URL happens by design.

    Having two shop installations connected to the same database doesn’t work either. Again, that’s by design.

    To have two distinct shops, one has to make the shop a multishop (switch this on in back office -> Preferences) and define all the URLs in back office -> Advanced Parameters -> Multistore. Last time I tried this worked just fine.



  • @Traumflug I can confirm, that redirections work for us too. We use it in live environment.


 

Looks like your connection to thirty bees forum was lost, please wait while we try to reconnect.