4 If you're using custompix in your theme, but you don't want to have to copy every pix from /pix into /theme/yourtheme/pix, use this as a 404 handler.
5 You need to put a snippet like the following into your apacheconfig:
7 <Location /moodle/theme/yourtheme/pix >
8 ErrorDocument 404 /moodle/pix/redirect.php
14 require_once('../config.php');
16 // obtain the requested path.
17 if (!array_key_exists('REDIRECT_STATUS',$_SERVER) ||
$_SERVER['REDIRECT_STATUS'] != 404) {
23 if (!preg_match('/theme\/[^\/]*\/pix\/(.*)$/',$_SERVER['REDIRECT_URL'],$matches)) {
27 if (file_exists($CFG->dirroot
.'/pix/'.$matches[1])) {
28 header("Location: ".$CFG->wwwroot
.'/pix/'.$matches[1]);
32 <!DOCTYPE HTML
PUBLIC "-//IETF//DTD HTML 2.0//EN">
34 <title
>404 Not Found
</title
>
37 <h1
>Picture not found
</h1
>
38 <p
><?php
echo $_SERVER['REDIRECT_ERROR_NOTES']; ?
></p
>