Created
June 11, 2016 15:12
-
-
Save christianhaendel/e2d5bacd733aec6d491ec36a8d00c61d to your computer and use it in GitHub Desktop.
Enable Realurl to select individual errorPage
This file contains 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 | |
class user_pageNotFound { | |
function pageNotFound($params,$tsfeObj) { | |
global $TYPO3_CONF_VARS; | |
$url = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL').'index.php?id='.$TYPO3_CONF_VARS['EXTCONF']['realurl'][\TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('HTTP_HOST')]['errorPage']; | |
$_buffer = $this->loadPage($url); | |
echo $_buffer; | |
} | |
function loadPage($url) { | |
$agent = "TYPO3 pageNotFoundFunction v1.0"; | |
$header[] = "Accept: text/vnd.wap.wml,*.*"; | |
$ch = curl_init($url); | |
if ($ch) { | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | |
curl_setopt($ch, CURLOPT_USERAGENT, $agent); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, $header); | |
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); | |
$tmp = curl_exec($ch); | |
if(FALSE == $tmp) { | |
print_r(curl_error($ch)); | |
} | |
curl_close($ch); | |
} | |
return $tmp; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Include 'pageNotFound_handling' => 'USER_FUNCTION:typo3conf/pageNotFoundHandling.php:user_pageNotFound->pageNotFound', in Localconfiguration.php FE section And setup in your realurl conf
$TYPO3_CONF_VARS['EXTCONF']['realurl']['domain.de']['errorPage']=PAGE_ID;