4

I read this KB article about localization though, the examples are for sub-folders.

I'm wondering how to handle the same concept but, for different language based domains e.g.

  • example.com
  • example.mx
  • example.es

Currently I'm not sure if the different sites will be based on language or country though, let's assume country for this question. For example we'll have Mexico and Spain sites, both will be in Spanish but, will have different content which relates to each country.

I asked CraftCMS about this on twitter and this was their reply.

Am I right to think that each site will have an install of craft, with the config/ general.php setup accordingly (in this case using domains instead of sub-folders?)

And then we'll just link to the db in it's settings on each copy of config/db.php

With that said, I'm hoping for some elaboration on this topic. Bonus points for including a multilingual, multi-domain and multi-environment for git workflow/setup in your answer ;)

2

You have one Craft install and one DB. Do everything described in that article, just replace the subfolder paths with the different domains:

return array(
    // ...
    'siteUrl' => array(
        'en' => 'http://example.com/',
        'es' => 'http://example.es/',
    ),
);

Then all you have to do is to configure your webhost so that it routes those domains to different index.php files. It should contain the info about the locale and point to Craft folder:

// Path to your craft/ folder
$craftPath = '../../craft';

// Tell Craft to serve the Spanish site
define('CRAFT_LOCALE', 'es');
| improve this answer | |
  • So the various index.php files would be renamed and would live on the main domain's hosting. Then we just point the other domains to their own, said index.php files? – Natetronn Jul 10 '14 at 21:12
  • Yes I see no reason this shouldn't work, or you put them in different folders. – carlcs Jul 10 '14 at 21:19
  • For pointing the non-main domains to their specific index.php files would you recommend doing and assuming the domain company allows it, DNS "CNAME" record change OR DNS "A record" change or other? – Natetronn Jul 10 '14 at 21:28
  • @Nate sorry can't help you with that. Good luck! – carlcs Jul 10 '14 at 21:29
  • No worries, I'm just fishing for as complete an answer as possible for everyone's reference. I think that's a good start, thanks! – Natetronn Jul 10 '14 at 21:34

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.