Story #65730

Usability pageNotFound handling

Added by Job Rutgers over 4 years ago. Updated over 1 year ago.

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

0%

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

Related to TYPO3 Core - Feature #50186: pageNotFound_handling should tell about misconfiguration Closed 2013-07-19

History

#1 Updated by Riccardo De Contardi over 1 year ago

[...] make the setup more user friendly out of the box.
For example a configuration in the backend for each root level/domain.[...]

I guess that at least those should have been achieved on 9.2 with the "Site handling" module (see https://typo3.org/article/typo3-v920-released/)

#2 Updated by Riccardo De Contardi over 1 year ago

  • Status changed from New to Closed

It seems that all mentioned points are already covered by "Site handling" module, therefore I think it should be safe to close this one for now.

Of course, if you think that this is the wrong decision or that there is still work to be done on this topic, please reopen it; I think that you could also add your feature requests on this topic as subtasks or related issues of #83796

Also available in: Atom PDF