[267] | 1 | <?php |
---|
[297] | 2 | /** |
---|
| 3 | * t29v6 404er Entry Point |
---|
| 4 | * |
---|
| 5 | * Will be called as ErrorDocument 404 which also catches old |
---|
| 6 | * file.shtml? URLs as well as old URLs which should be remapped |
---|
| 7 | * to new ones. |
---|
| 8 | * |
---|
| 9 | **/ |
---|
[267] | 10 | |
---|
[297] | 11 | // standard arguments |
---|
| 12 | $seiten_id = '404'; |
---|
| 13 | $version = '$Id$'; |
---|
| 14 | $titel = "404 Seite nicht gefunden"; |
---|
| 15 | $dynamischer_inhalt = true; |
---|
| 16 | |
---|
| 17 | $lib = dirname(__FILE__); |
---|
| 18 | require "$lib/technikum29.php"; |
---|
| 19 | |
---|
| 20 | #require_once "$lib/link.php"; |
---|
| 21 | |
---|
| 22 | $wanted_page = $_SERVER['REQUEST_URI']; |
---|
| 23 | |
---|
| 24 | # check if page exists when replacing '.shtml?' => '.php': |
---|
| 25 | $phpext_path = $_SERVER['DOCUMENT_ROOT'] . preg_replace('/\.shtml?$/i', '.php', $wanted_page); |
---|
| 26 | if(file_exists($phpext_path)) { |
---|
| 27 | $noext_path = preg_replace('/\.shtml?$/i', '', $wanted_page); |
---|
| 28 | header('HTTP/1.1 301 Moved Permanently'); |
---|
| 29 | header('Location: '.$noext_path); |
---|
| 30 | exit; |
---|
| 31 | } |
---|
| 32 | |
---|
| 33 | # check that moved pages: |
---|
| 34 | $redirects = array( |
---|
[267] | 35 | # Inhaltsseiten |
---|
[268] | 36 | #'/de/suche' => '/de/wir-suchen', # ups, das geht natuerlich |
---|
| 37 | #'/en/search' => '/en/wanted', # so nicht. da es die neuen seiten ja jetzt gibt. |
---|
[267] | 38 | |
---|
| 39 | # Geraete/Extraseiten |
---|
| 40 | '/de/geraete/anita' => '/de/rechnertechnik/elektronenroehren', |
---|
| 41 | '/en/devices/anita' => '/en/computer/electron-tubes', |
---|
| 42 | '/de/geraete/combitron' => '/de/rechnertechnik/programmierbare', |
---|
| 43 | '/en/devices/combitron' => '/en/computer/programmable', |
---|
| 44 | '/de/geraete/ibm_77' => '/de/rechnertechnik/lochkarten-edv#ibm77', |
---|
| 45 | '/de/geraete/kernspeicher' => '/de/rechnertechnik/speichermedien#kernspeicher', |
---|
| 46 | '/de/geraete/laufzeitspeicher' => '/de/rechnertechnik/speichermedien#laufzeitspeicher', |
---|
| 47 | '/de/geraete/pdp_8I' => '/de/rechnertechnik/fruehe-computer#pdp8i', |
---|
| 48 | '/de/geraete/univac9400' => '/de/rechnertechnik/univac9400', |
---|
| 49 | '/de/geraete/univac9400/univac_9300' => '/de/rechnertechnik/univac9200', |
---|
| 50 | '/en/devices/univac9400/univac_9300' => '/en/computer/univac9200', |
---|
[297] | 51 | '/de/geraete/bull-bs-pr' => '/de/rechnertechnik/tabelliermaschine', |
---|
| 52 | ); |
---|
[267] | 53 | |
---|
[297] | 54 | foreach($redirects as $source => $target) { |
---|
| 55 | if(strcasecmp($source, $wanted_page) == 0) { |
---|
| 56 | # we got a match |
---|
| 57 | header('HTTP/1.1 301 Moved Permanently'); |
---|
| 58 | header('Location: '.$target); |
---|
| 59 | exit; |
---|
| 60 | } |
---|
| 61 | } |
---|
| 62 | |
---|
[307] | 63 | require_once "$lib/client.php"; |
---|
| 64 | if(t29Client::getLanguage() == "de") { |
---|
[297] | 65 | ?> |
---|
| 66 | <h2>404 Seite nicht gefunden</h2> |
---|
| 67 | <address><?=$wanted_page; ?></address> |
---|
[307] | 68 | <p>Unsere Website wurde im Herbst 2012 neugestartet. Sie können unsere Suche oder |
---|
| 69 | die Navigation verwenden, um vielleicht doch noch an die gewünschten Informationen |
---|
| 70 | zu kommen.</p> |
---|
| 71 | <?php |
---|
| 72 | } else { // language |
---|
| 73 | ?> |
---|
| 74 | <h2>404 Page not found</h2> |
---|
| 75 | <address><?=$wanted_page; ?></address> |
---|
| 76 | <p>Our website was reconstructed in autumn 2012. Maybe you find your wanted website |
---|
| 77 | in the navigation or our new search form.</p> |
---|
| 78 | <?php |
---|
| 79 | } // language |
---|