Jump to content
thirty bees forum
  • 0

Multistore redirection not working as it should


Question

Posted

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?

7 answers to this question

Recommended Posts

  • 0
Posted

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:

``` SetEnv HTTPMODREWRITE On

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 %{REQUESTFILENAME} -s [OR] RewriteCond %{REQUESTFILENAME} -l [OR] RewriteCond %{REQUESTFILENAME} -d RewriteCond %{HTTPHOST} ^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 %{HTTPHOST} ^siteB.com$ RewriteRule ^loja$ /loja/ [L,R] RewriteCond %{HTTPHOST} ^siteB.com$ RewriteRule ^loja/(.*) /$1 [L]

Dispatcher

RewriteCond %{REQUESTFILENAME} -s [OR] RewriteCond %{REQUESTFILENAME} -l [OR] RewriteCond %{REQUESTFILENAME} -d RewriteCond %{HTTPHOST} ^siteB.com$ RewriteRule ^.$ - [NC,L] RewriteCond %{HTTP_HOST} ^siteB.com$ RewriteRule ^.$ %{ENV:REWRITEBASE}index.php [NC,L]

AddType application/vnd.ms-fontobject .eot AddType font/ttf .ttf AddType font/otf .otf AddType application/font-woff .woff AddType application/font-woff2 .woff2 Header add Access-Control-Allow-Origin "*"

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"

Header unset Etag FileETag none 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

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

```

  • 0
Posted

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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...