Return to Snippet

Revision: 37350
at December 8, 2010 21:22 by FazzyX


Initial Code
<?php
define(LOGIN_URL, "http://domain.tld/login.html");
define(NOTFOUND_URL, "http://domain.tld/not-found.html");
 
class user_pageNotFound {
  function pageNotFound($param, $ref) {
    if ($param["pageAccessFailureReasons"]["fe_group"] != array(""=>0)) {
      header("HTTP/1.0 403 Forbidden");
      $url = LOGIN_URL."?redirect_url=" . $param["currentUrl"];
    } else {
      $url = NOTFOUND_URL;    
    }
    
    session_start();
    $strCookie = 'PHPSESSID=' . $_COOKIE['PHPSESSID'] . '; path=/';
    session_write_close(); 
  
    $c = curl_init();
    curl_setopt($c, CURLOPT_URL, $url);
    curl_setopt($c, CURLOPT_COOKIE, $strCookie);
    $contents = curl_exec($c);
    curl_close($c);

    if ($contents) return $contents;
        else return FALSE;
  }
} 
?>

Initial URL


Initial Description
<p>TYPO3 pageNotFoundHandling with determination of 404 and 401/403 stats. </p>

<p>Modify LOGIN_URL and NOTFOUND_URL !</p>

<p>Save as pageNotFoundHandling.php and point to this from Install Tool setting.</p>

<p>[FE][pageNotFound_handling] = USER_FUNCTION:fileadmin/scripts/pageNotFoundHandling.php:user_pageNotFound->pageNotFound</p>

<p>Enable cURL by setting [SYS][curlUse] = 1 at Install Tool</p>

<p>cURL must provide from system !</p>

<p>To get redirected after login to the request page, you have to use 'defined by GET/POST-Vars' at felogin redirect mode</p>

Initial Title
pageNotFoundHandling

Initial Tags


Initial Language
PHP