Opencart Multi-Store help please

Hi I’ve been trying to set up an Opencart multi-store without success, can anyone please help me to get it working?

The concept sounds easy enough in their guide here: Multi-Store - OpenCart Documentation

But doing this on Virtualmin doesn’t work for me.

I’ve installed opencart on a subdomain like this: shop1.domain.com

Then I’ve created another subdomain at shop2.domain.com
and found its /etc/apache2/sites-available/shop2.domain.com config file.

Then I set the DocumentRoot as /home/domain.com/domains/shop1.domain.com/public_html

so that they share the same public_html folder.

Then in my Opencart shop admin area for shop1 I’ve added shop2.domain.com as a second store in the Opencart settings.

This kinda almost works. If i navigate to https://store2.domain.com

Then it redirects itself to www.store2.domain and does actually show the shop (albeit unsecure and not using the ssl I’ve set up.

If I navigate to shop1.domain.com then that shows up fine and works with SSL etc.

But the problem is it only sort of appears to work, as when I visit shop2.domain.com the title in the browser is for shop1 and all the products shown are shop1’s - so it’s just sort of working like an alias and not a different shop.

Reading on the forums it seems some users have managed to get this to work, but there are no current threads open that I can ask how they got it working.

can anyone please help? Thanks very much.

It’s redirecting to the default domain in Virtualmin (shop1, the first domain you set up) because your SSL isn’t properly configured.

Did you get a certificate from Lets Encrypt or are you using a self signed? If you’re using self signed, that’s probably the issue.

If the two domain are to use the same document root then use the alias option in Virtualmin when you create the second virtual server / domain.

In a nutshell, don’t

  1. create a normal virtual server
  2. and then manually change the document root to point to some other virtual server.

Use the alias option instead when you use Virtualmin → Create Virtual Server. Doing so will accomplish 1 and 2 above in a single operation in Virtualmin and will also help you (and Virtualmin) understand how domains are set up in your environment.

@Gomez_Adams has a valid point about SSL certificates. Using Virtualmin’s alias option will automatically apply and renew SSL certificates from Let’s Encrypt.