Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Country-specific sub-directories - one instance of each page


Reply

302 Views

Avatar
Rod

8 February 2013 at 2:14pm (Last edited: 11 February 2013 8:36am), Community Member, 12 Posts

Hi there,

Currently, we have a Silverstripe website which uses IP detection to serve different versions of the site to various countries. To achieve this I've created extra content fields in the CMS (e.g. Content - UK) and written conditions in the templates along the lines of:

if user is from UK, and 'Content - UK' is not empty, show UK content, otherwise show default content.

I've also set up checkboxes in the CMS like 'don't show in UK', 'don't show in AU' etc.
The different localised versions of each page each have the same URL. The exception to this is in the UK, where we have a .co.uk domain which uses content replicated from the .com version.

We need to change this for a couple of reasons - SEO requirements and the reliability of our site replication process.

So, here's what I'd like to achieve:

  • - One instance of the cms (essentially like we already have, seeing as we don't touch the replicated UK copy).
  • - One domain with several country-specific sub-directories. These need to be: example.com/nz, example.com/uk, example.com/us, example.com/au and (ideally) a fallback if the visitor's IP isn't from one of these countries, which could be example.com/en.
  • - One instance of each page. 90% of the pages will be the same for all countries - there'll just be a handful which will either be only applicable to one or two countries, or will exist at all countries but will have slightly different content in each.

EDIT: I originally asked about 'sub-domains', but of course I actually meant sub-directories, as per the url examples.

Has anyone done anything like this before with Silverstripe? Can anyone point me in the right direction as to what to do or where to start!?

Many thanks
Liam