"; print_r( $_SERVER); echo ""; die; */ //Remove request parameters: list($path) = explode('?', $_SERVER['REQUEST_URI']); //Remove script path: //$path = substr($path, strlen($_SERVER['SCRIPT_NAME'])+1); //Explode path to directories and remove empty items: $pathInfo = array(); foreach (explode('/', $path) as $dir) { if (!empty($dir)) { $pathInfo[] = urldecode($dir); } } /* if (count($pathInfo) > 0) { //Remove file extension from the last element: $last = $pathInfo[count($pathInfo)-1]; list($last) = explode('.', $last); $pathInfo[count($pathInfo)-1] = $last; } */ //echo "
";

//print_r($path);

//print_r($pathInfo);
//echo "
"; $tar_filename = ''; $pattern = array(); if ( isset ( $pathInfo[0] ) ) { if ( isset ( $url_mapping[$pathInfo[0]] ) ) { $tar_filename = $url_mapping[$pathInfo[0]]['filename']; } if ( $pathInfo[0] == 'index.php' ) { $tar_filename = 'index-20111214.php'; } }else { $tar_filename = 'index-20111214.php'; } //echo $tar_filename; if ( isset ( $pathInfo[1] ) ) { if ( isset ( $url_mapping[$pathInfo[0]]['pattern'] ) ) { $pattern = $url_mapping[$pathInfo[0]]['pattern']; $repeat_times = min ( count ($pattern) , ( count( $pathInfo ) -1 ) ); //var_dump ($pattern); for ( $i=0; $i<$repeat_times; $i++ ) { //echo $i . ' '; if ( preg_match( $pattern[$i][1], $pathInfo[1+$i], $tmp_match ) ) { $$pattern[$i][0] = $tmp_match[0]; //Assign back the matched pattern in to variable //echo $pattern[$i][0] . ' => ' ; //var_dump( $tmp_match[0] ); $_GET[$pattern[$i][0]] = $tmp_match[0]; $_GET['rewrite'][$pattern[$i][0]] = $tmp_match[0]; } } } } //echo ""; if ( !empty ( $tar_filename ) ) { if ( is_file( $tar_filename ) ) { include $tar_filename; die; } } //Shouldn't go here, otherwise, it is meaning not found header('HTTP/1.0 404 not found'); exit; ?>