Created
March 28, 2018 14:04
-
-
Save hasenbalg/01d27f1dadc865d2efc45f1ca1819170 to your computer and use it in GitHub Desktop.
Typo3 404 in chosen language
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function logger($value) | |
{ | |
$output = "\n" . print_r($value, TRUE) . "\n"; | |
file_put_contents('php://stderr', $output); | |
//observe in apache log (tail -f /var/log/apache2/error.log) | |
} | |
// http://wiki.sklein-medien.de/doku.php?id=typo3:404 | |
if (!defined('TYPO3_MODE')) {die('Access denied.');} | |
$GLOBALS ['TYPO3_CONF_VARS']['FE']['debug'] = true; | |
$languages = $GLOBALS['TYPO3_CONF_VARS']['EXTCONF']['lang']['availableLanguages']; | |
$uri = $_SERVER['REQUEST_URI']; | |
logger($uri); | |
foreach ($languages as $l) { | |
$l = ($l == 'da') ? 'dk' : $l; //fix danish /da/ | |
$pattern = '/\/' . $l . '\//'; | |
if (preg_match($pattern, $uri)) { | |
$GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling'] = ''.$l.'/404/'; | |
} | |
} | |
logger($GLOBALS['TYPO3_CONF_VARS']['FE']['pageNotFound_handling']); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment