blanco Posted October 29, 2019 Share Posted October 29, 2019 I'm building two sites that shares the same front end, templates, modules etc. It's just the content that will differ. What is the best practice for building this locally. I'm thinking of just duplicating the database, and switch between the two in config.php. Is this practice considered good? Is there a risk of overwriting files/images when uploading? Thanks! Link to comment Share on other sites More sharing options...
elabx Posted October 29, 2019 Share Posted October 29, 2019 Here's what's on the official docs about multisite setups: https://processwire.com/docs/more/multi-site-support/ If you have access to the server's system, you could symlink the files of one Site A folder to the template files of Site B so you can keep template updates in sync. Link to comment Share on other sites More sharing options...
blanco Posted October 29, 2019 Author Share Posted October 29, 2019 Thanks! Option #1 doesn't really fit my needs as I will end up with two copies of the same site in different folders. I have tried another option mentioned in this thread: I just switch databases in config.php together with the config->paths->assets, and it seem to work fine. Do you see any problems with this setup? Link to comment Share on other sites More sharing options...
dragan Posted October 29, 2019 Share Posted October 29, 2019 Do you need one single PW admin for both sites? Or each site has its own PW-backend? Link to comment Share on other sites More sharing options...
blanco Posted October 29, 2019 Author Share Posted October 29, 2019 I want one single pw install. But I want to have a method for just switching between two databases when developing locally. So far, the solution I mentioned above seem to do the trick. I have added this config.php: else if($domain == "sitetwo.com"){ $config->dbHost = '127.0.0.1'; $config->dbName = 'site_two'; $config->dbUser = 'root'; $config->dbPass = 'root'; $config->dbPort = '3306'; $config->paths->assets = $config->paths->site . 'assets_two/'; $config->urls->assets = $config->urls->site . 'assets_two/'; $config->paths->files = $config->paths->site . 'assets_two/files/'; $config->urls->files = $config->urls->site . 'assets_two/files/'; $config->paths->cache = $config->paths->site . 'assets_two/cache/'; $config->urls->cache = $config->urls->site . 'assets_two/cache/'; $config->paths->logs = $config->paths->site . 'assets_two/logs/'; $config->urls->logs = $config->urls->site . 'assets_two/logs/'; } $domain is just a variable that I set manually, to switch between the two databases/sites. Is this a good or bad approach? Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now