3

I've seen many similar questions (Multiple databases, single codebase) but now a little confused on the best approach. This is our first Craft CMS site so still learning the possibilities.

We have domainone.com and domaintwo.com which will be almost identical in design and functionality but the copy throughout will be slightly different as each website is for the same brand but different locations (same country).

In a perfect scenario, both websites will share the same assets, CSS/JS, templates and plugins as they require the same functionality, however, they'll have their own login areas to manage their own content.

Approx. half of the content will be the same i.e. new and used vehicles, but they'll have different pages such as 'about us', 'meet the team' and so on.

Would the best option be to just copy over the plugins, templates etc to a fresh installation and separate the two completely or is there a way to achieve this 'perfect scenario'?

2

As long as your sites are hosted on the same server, you can easily share templates and plugins between them by defining the appropriate path constants in the index.php files for your sites:

define('CRAFT_PLUGINS_PATH', '/absolute/path/to/your/plugins/folder');
define('CRAFT_TEMPLATES_PATH', '/absolute/path/to/your/templates/folder');

As for your resources (i.e. CSS and JavaScript files), symbolic linking is an option. However, I would recommend following Tom Bauer's suggestion in his answer – pick one domain and serve all assets from that domain's public folder, or even better: host the resources on a CDN.

1

You could use a deployment solution like Beanstalk to update both your template folders with one push. I would think you could use the same assets folder fairly easily as long as the folder lives above the "craft" folder for both installations.

  • Interesting, thanks! Never thought of that route. I'm exploring Multi-Environment options first to see what's actually possible with Craft but can always fall back to this. – JonnyT May 28 '16 at 7:19
1

You could make use of symbolic links. This works if your sites are:

  • on the same system
  • your system is running on a Linux server environment
  • you have console access (ex. SSH)

With symbolic links you can easily "mirroring" folders like css/js and templates, plugins, etc.. For the assets it's maybe better to use only one url and pointing to this over all domains. This avoiding dublicated content in Google&Co..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.