Index: trunk/core/kernel/utility/http_query.php =================================================================== diff -u -N -r3685 -r3822 --- trunk/core/kernel/utility/http_query.php (.../http_query.php) (revision 3685) +++ trunk/core/kernel/utility/http_query.php (.../http_query.php) (revision 3822) @@ -448,23 +448,23 @@ } }while (!$template_found && $template_parts); - + // try to find template in virtual templates in case if such ability exists if (constOn('CMS') && !$template_found) { - + $template_parts = $url_parts; $url_parts = Array(); do { $template_path = implode('/', $template_parts); - + $sql = 'SELECT PageId FROM '.TABLE_PREFIX.'Pages WHERE Path = '.$this->Conn->qstr($template_path); $template_found = $this->Conn->GetOne($sql); if(!$template_found) { array_unshift( $url_parts, array_pop($template_parts) ); } - + }while (!$template_found && $template_parts); } } @@ -478,20 +478,21 @@ if($template_found) { $template_path = $module_folder.'/index'; + array_shift($url_parts); } else { // 2. return error template then $template_found = true; $template_path = $this->Application->ConfigValue('ErrorTemplate'); if(!$template_path) $template_path = 'error_notfound'; - + header('HTTP/1.0 404 Not Found'); } } $this->Set('t', $this->getDefaultTemplate($template_found ? $template_path : '') ); - + // pass params left to module $this->Application->Phrases->Init('phrases');