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.

Customising the CMS /

i18n / translatable: keeping the same url segment for multiple languages


Reply


746 Views

Avatar
Anatol

126 Posts

14 October 2011 at 4:33pm

Hi,

I just updated Silverstripe to the latest version on an approximately 3 years old multilingual site. It seems that now translated pages automatically change the URLSegment to the locale code, e.g. mydomain.com/my-page when translated becomes mydomain.com/my-page-mi-NZ .

I would much prefer to keep the URLSegment the same as the default language and solve the locale setting with a subdomain such as en.mydomain.com and mi.mydomain.com that then uses a .htaccess rewrite, for example

RewriteCond %{HTTP_HOST} ^mi\.mydomain\.com
RewriteRule ^(.*) $1?locale=mi-NZ&%{QUERY_STRING}

So when I access the page http://mi.mydomain.com/my-page
it actually opens
http://mi.mydomain.com/my-page?locale=mi-NZ
(the subdomain is not really important in the rewritten URL)

Any hint on how to keep URL segments same as the page in the default language would be highly appreciated.

Cheers!
Anatol