Skip to content

Instantly share code, notes, and snippets.

@a-r-m-i-n
Created July 28, 2015 12:05
Show Gist options
  • Select an option

  • Save a-r-m-i-n/2f646f499188d549827c to your computer and use it in GitHub Desktop.

Select an option

Save a-r-m-i-n/2f646f499188d549827c to your computer and use it in GitHub Desktop.
Multi language error handling for TYPO3 & RealURL
<?php
$GLOBALS['USER']['vendorname']['domainConfigurations'] = array(
'domain.tld' => array('rootpageUid' => 1, 'languages' => array('en' => 1)),
);
<?php
// ...
if (isset($_SERVER['REQUEST_URI']) && isset($_SERVER['HTTP_HOST'])) {
$languageKey = substr($_SERVER['REQUEST_URI'], 1, 2);
if (array_key_exists($_SERVER['HTTP_HOST'], $GLOBALS['USER']['vendorname']['domainConfigurations'])) {
$configuration = $GLOBALS['USER']['vendorname']['domainConfigurations'][$_SERVER['HTTP_HOST']];
if (array_key_exists($languageKey, $configuration['languages'])) {
$TYPO3_CONF_VARS['FE']['pageNotFound_handling'] = $languageKey . '/' . $TYPO3_CONF_VARS['FE']['pageNotFound_handling'];
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment