Answer the question
In order to leave comments, you need to log in
2 identical sites in one yii2 advanced?
It is necessary to create 2 identical sites with different content (2 organizations of the same company, only headers, footers and headings will differ).
I plan to create modules, store them in common
- the logic will be the same. Databases will be used different (but the same in structure), so the content will be different accordingly. By default, two applications are created - frontend
and backend
. In principle, just my option is to send one site to a backend
folder in virtual hosts, and the second to a folder, and frontend
you don’t need to change anything else.
Another thing is that it somehow looks "no ice". For good, it's better to rename these folders under the appropriate names: site-too
, site-ip
. What is the best way to do this? Scattered throughout the framework are the names backend
and frontend
.
Answer the question
In order to leave comments, you need to log in
Without problems, a copy of the frontend with an arbitrary name is created. There is no mention of frontend and backend anywhere. Everything will work out of the box, just point to the desired index.php and that's it. I did this many times, with only 1 base and a common backend, but this is not an obstacle.
It should be done as modules, because the resources stored in the web folder (styles, scripts) will either have to be duplicated for each folder of your sites, or you will have to create web in common and register a separate subdomain for it. Otherwise, you can simply specify your own database and layout for each module, make the basic controllers in common, and simply use them in modules. It makes sense to copy folders only if changes in scripts or styles are foreseen.
upd: and even better - in your case - just make the web-site1 and web-site2 folders, where only index.php will be, and include main-local1 or main-local2 configs in them, which will have different databases. Set up two entry points and that's it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question