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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

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

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

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


Go to End


2 Posts   1329 Views

Avatar
Rod

Community Member, 12 Posts

8 February 2013 at 2:14pm

Edited: 11/02/2013 8:36am

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

Avatar
abstract

Community Member, 2 Posts

29 September 2015 at 10:42am

Hey

Did you manage to find a solution for this?