Changeset 297 in t29-www for lib/404.php
- Timestamp:
- Sep 15, 2012, 7:32:28 PM (12 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
lib/404.php
r295 r297 1 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 **/ 2 10 3 array( 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( 4 35 # Inhaltsseiten 5 36 #'/de/suche' => '/de/wir-suchen', # ups, das geht natuerlich … … 18 49 '/de/geraete/univac9400/univac_9300' => '/de/rechnertechnik/univac9200', 19 50 '/en/devices/univac9400/univac_9300' => '/en/computer/univac9200', 20 '/de/geraete/bull-bs-pr/*' => '/de/rechnertechnik/tabelliermaschine', 51 '/de/geraete/bull-bs-pr' => '/de/rechnertechnik/tabelliermaschine', 52 ); 21 53 22 ); 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 63 ?> 64 <h2>404 Seite nicht gefunden</h2> 65 66 <p>Die gewünschte Adresse 67 68 <address><?=$wanted_page; ?></address> 69 70 <p>konnte nicht geladen werden. Probieren Sie folgendes... blabla ...
Note: See TracChangeset
for help on using the changeset viewer.