source: t29-www/lib/404.php @ 1375

Last change on this file since 1375 was 736, checked in by sven, 9 years ago

Und der nächste Typo.

File size: 3.1 KB
Line 
1<?php
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 **/
10
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__);
18require "$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);
26if(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(
35        # Inhaltsseiten
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.
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',
51        '/de/geraete/bull-bs-pr' => '/de/rechnertechnik/tabelliermaschine',
52);
53
54foreach($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
63// compile a search query from the path
64$query = preg_replace('%[/\?=\+]%', ' ', $wanted_page);
65$query = preg_replace('%\s+%', ' ', $query);
66
67require_once "$lib/client.php";
68if(t29Client::getLanguage() == "de") {
69?>
70<h2>404 Seite nicht gefunden</h2>
71<address><?=$wanted_page; ?></address>
72<p>Unsere Website wurde vor kurzem neugestartet. Sie können unsere Suche oder
73die Navigation verwenden, um vielleicht doch noch an die gewünschten Informationen
74zu kommen. Auch kann unsere <a href="/de/sitemap.php">Sitemap</a> hilfreich sein.</p>
75
76<?php /* TODO: URL by message (topnav-search-...) and host rewrite */ ?>
77<form action="/de/suche.php">
78<input type="text" value="<?php echo $query; ?>" name="q">
79<input type="submit" value="Suchen">
80</form>
81
82<?php
83} else { // language
84?>
85<h2>404 Page not found</h2>
86<address><?=$wanted_page; ?></address>
87<p>Our website was reconstructed in autumn 2012. Maybe you find your wanted website
88in the navigation or our new search form.</p>
89<?php
90} // language
Note: See TracBrowser for help on using the repository browser.
© 2008 - 2013 technikum29 • Sven Köppel • Some rights reserved
Powered by Trac
Expect where otherwise noted, content on this site is licensed under a Creative Commons 3.0 License