Project

General

Profile

Actions

Story #65730

closed

Usability pageNotFound handling

Added by Job Rutgers about 9 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
-
Target version:
-
Start date:
2015-03-14
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
Tags:
Sprint Focus:

Description

In my opinion the setup for the pageNotFound handling in the current Typo3 versions is not that user friendly. I know there are some extensions to make it better, but I think Typo3, as a modern CMS, should make the setup more user friendly out of the box.
For example a configuration in the backend for each root level/domain.

My current configuration feels a bit strange to me:
[FE][pageNotFound_handling] = USER_FUNCTION:fileadmin/php/pageNotFound.php:user_pageNotFound->pageNotFound
with pageNotFound.php:

define(LOGIN_URL, 'https://www.domain.nl/login');
define(NOTFOUND_URL, 'https://www.domain.nl/page-not-found');
class user_pageNotFound {
  /*
   * $params = Array mit den Werten currentUrl, reasonText und pageAccessFailureReasons
   * $ref = Referenz auf das Seiten-Objekct von TYPO3 (TSFE)
   */

  function pageNotFound($params, $ref) {

    if(current($params["pageAccessFailureReasons"]["fe_group"]) !== 0) {

      // Benutzer hat eine Seite aus dem geschtzten Bereich aufgerufen, 
      // ist aber nicht eingeloggt -> Login + Redirect

      $login[0] = LOGIN_URL;
      $login[1] = LOGIN_URL;
      $login[2] = LOGIN_URL;
      $L = (array_key_exists('L', $_GET) ? $_GET['L'] : 0);
      header('Location: ' . $login[$L] . '?redirect_url=' . urlencode($params["currentUrl"]));

    } else {

      // Benutzer hat eine nicht existierende Seite aufgerufen -> Error 404

      header("HTTP/1.0 404 Not Found");
      echo implode ('', file (NOTFOUND_URL));
    }
  }
}


Related issues 1 (0 open1 closed)

Related to TYPO3 Core - Feature #50186: pageNotFound_handling should tell about misconfigurationClosed2013-07-19

Actions
Actions

Also available in: Atom PDF