This works for
http://www.someurl.com/subdir/../../langcode/Code:
function tgTranslatorPostFilterHook($data, $language, $engine, $url, $translationError = false) {
if($translationError) {
// 302 temporary redirect to the original untranslated page for any ‘TRANSLATION ERROR’ @header(”HTTP/1.1 302 Moved Temporarily”);
@header("Location: " . $url);
@header("Status: 302 Moved Temporarily");
exit();
}
$subs = 'dir1|dir2|dir3';
$domain = 'someurl';
$langs = 'de|pt|pt_BR|ko|es|es_MX|fr|it|ja|zh|zh_TW|ar|nl|el|ru|no|en|bg|hr|cs|da|fi|hu|is|tl|pl|ro|sr|sl|cy|tr|la|sv';
$expression = '%(http://www\.'.$domain.'\.com/(?:'.$subs.')(?:/[^/]+)*)/('.$langs.')/%';
return preg_replace($expression,'\1',$data);
}