How to config three frontends with one backend

(Admin) #1

I want to construct three different frontends (brands of the same company with different styles) sharing the same backend data with yii2 advanced template.
But I need to use direct different domains for the frontends. Urls like these:

(Giannisdag) #2

I cannot understand. The frontend2 is a redirect to general or you want to project the same product in both sites?

(Admin) #3

Thank your for answering giannis.
I want to maintain the products, brands and other tables in an unique backend. Example: products table will have a field with the brand_id to have the relation…
When you write in the browser (general info of the company) the index could view info about the company and info about all products of the different brands.
When you write in the browser I want to show only the info and products of brand1 with the logo and corporative colors of this brand.
With only one domain, the url to obtain this could be I can do this but I dont want this url, I want to tranform the url using the direct domains for every brand, like And show this domain visible in the browser for other pages too… like… Not transform to

I dont know how to do this redirection in a shared hosting. In a .htaccess? in frontend/config.php?

(Giannisdag) #4

A possible answer could be this. Create the different vhosts in apache. All look at the same controller. Then in controller read the Request->hostinfo data. From there, you can separate per site and give the right response for the view and the database data, meaning creating different sql queries for each site, different render for each site too.

(Auzadventure) #5
  1. You can use modules and the backend.

Then just hook up the urlmanager and htaccess to each of the modules

  1. Then you just do => /brand1/site/index

  2. You need to setup your addon domain to point to the right path.

(Admin) #6

Thank you gianinis and auzadventure. I´m going to try your two ways.
I have also found the same idea with modules here: How to map domains to modules