protected function _createURL($base, $controller, $action, $params, $searchDefined = true)
    {
        $params['controller'] = $controller;
        $params['action'] = $action;
        foreach ($this->urlRoutes as $route => $defined) { // first check those with strict params.
            $cBase = $base;
            $preparedParams = $params;
            if ($searchDefined) {
                if (is_numeric($route)) {
                    continue; // first only get those with defined conditions.
                }
                $match = true;
                foreach ($defined as $def => $value) { // first check if those exact values match.
                    if (($value || '0' === $value) && (!isset($params[$def]) || $params[$def] != $value)) {
                        $match = false;
                    } else {
                        unset($preparedParams[$def]);
                        if ('module' == $def) {
                            if (substr($cBase, -1 * strlen($value . '/')) == $value . '/') { // remove module from base url if it's there
                                $cBase = substr($cBase, 0, strlen($cBase) - strlen($value . '/'));
                            }
                        }
                    }
                }
                if (!$match) {
                    continue;
                }
            }
            $match = true;
            preg_match_all('/\(\?<([a-z0-9_\-]+)>.*?\)/', is_numeric($route) ? $defined : $route, $matches);
            if (!$matches) {
                continue;
            }
            $toReplace = array('\/' => '/');
            foreach ($matches[1] as $k => $word) {
                $match = $match & isset($params[$word]);
                if ($match) {
                    $toReplace[$matches[0][$k]] = $params[$word];
                    unset($preparedParams[$word]);
                } else {
                    break;
                }
            }

            if ($match) {
                unset($preparedParams['module']);
                return $cBase . str_replace(array_keys($toReplace), array_values($toReplace), is_numeric($route) ? $defined : $route) . $this->_params2string($preparedParams) . '.html';
            }
        }
        if ($searchDefined) {
            return $this->_createURL($base, $controller, $action, $params, false);
        }

    }