wez             Thu Feb  5 09:57:34 2004 EDT

  Modified files:              
    /livedocs   error.php 
  Log:
  Make this work under IIS
  
  
http://cvs.php.net/diff.php/livedocs/error.php?r1=1.4&r2=1.5&ty=u
Index: livedocs/error.php
diff -u livedocs/error.php:1.4 livedocs/error.php:1.5
--- livedocs/error.php:1.4      Fri Jan 23 09:58:38 2004
+++ livedocs/error.php  Thu Feb  5 09:57:33 2004
@@ -18,12 +18,23 @@
 // | Handles the 404 error and try to redirect to the good place.         |
 // +----------------------------------------------------------------------+
 //
-// $Id: error.php,v 1.4 2004/01/23 14:58:38 didou Exp $
+// $Id: error.php,v 1.5 2004/02/05 14:57:33 wez Exp $
+
+/* handle IIS style 404 handler */
+if (strncmp($_SERVER['SERVER_SOFTWARE'], "Microsoft", 9) == 0 &&
+        strncmp($_SERVER['QUERY_STRING'], "404;", 4) == 0) {
+
+    $rurl = parse_url(substr($_SERVER['QUERY_STRING'], 4));
+
+    $_SERVER['REDIRECT_URL'] = $rurl['path'];
+    if (isset($rurl['query'])) {
+        $_SERVER['REDIRECT_URL'] .= '?' . $rurl['query'];
+    }
+}
 
 if (!empty($_SERVER['REDIRECT_URL'])) {
     // This is the requested page that caused the error
     $current_page = substr($_SERVER['REDIRECT_URL'], strlen(WEBBASE));
-
     if (strncmp(substr($current_page, -5), ".html", 5)) {
         if (preg_match('|([A-Za-z_]{2,5})/(.*)|', $current_page, $m)) {
             $current_page = $m[2];

Reply via email to