RealURL: alte URL -> neue URL [Gelöst]


  • 1
  • ArminB ArminB
    Jedi-Meister
    0 x
    410 Beiträge
    0 Hilfreiche Beiträge
    09. 06. 2007, 17:18

    moin,

    vielleicht hilft das http://typo3.intervation.de/extensionen/realurl/error-meldung-umleiten.html

    Armin

  • tobru tobru
    T3PO
    0 x
    14 Beiträge
    0 Hilfreiche Beiträge
    24. 06. 2007, 11:40

    Hallo Zusammen

    Ich habe das über das page not found handling gemacht.
    Mein kleines Skript hat mehrere Funktionen:

    * Ruft jemand eine alte URL auf, wird er auf die neue weitergeleitet (via 301 Moved Permanently
    * Ruft jemand eine URL aus dem geschützten Bereich auf und ist nicht eingeloggt, wird er auf die Login Seite weitergeleitet (via 303 See Other)
    * Ruft jemand eine nicht vorhandene Seite auf, bekommt er eine 404 Not Found Meldung und wird je nach Browser auf die 404 Seite mit weiteren Infos (zb Sitemap) weitergeleitet.

    Gruss
    Tobias

    typo3conf/pagenotfoundhandling.php

    1. <?php
    2. class user_pageNotFound {
    3. function pageNotFound($param, $ref) {
    4. $currentDomain = "www.domain.tld";
    5. //Wurde eine alte URL eingegeben? Redirect zu neuer
    6. if(preg_match('/.html/',$param['currentUrl'])) {
    7. $pagename = preg_replace('/.html/', '/', $param['currentUrl']);
    8. $location = "Location: http://$currentDomain$pagename";
    9. header('HTTP/1.1 301 Moved Permanently');
    10. header($location);
    11. }
    12. //Wurde die URL des Intern Bereich eines nicht eingeloggten Users eingegeben?
    13. elseif(preg_match('/intern/',$param['currentUrl'])) {
    14. $currurl = $param['currentUrl'];
    15. header('HTTP/1.1 303 See Other');
    16. header("Location: http://$currentDomain/abteilung/loginlogout/?redirect_url=$currurl");
    17. }
    18. //die URL ist nicht vorhanden...
    19. else {
    20. header('HTTP/1.0 404 Not Found');
    21. echo "<html><head><meta http-equiv=\"refresh\" content=\"0; URL=http://$currentDomain/notinmenu/error-404/\"></head><body>404, Page not found. Redirect to <a href=\"http://$currentDomain/notinmenu/error-404/\">info page</a>...</body></html>";
    22. }
    23. }
    24. }
    25. ?>

  • 1