На сайте используются ЧПУ ссылки, код из htaccess:
Options -Indexes
Options -Includes
Options +FollowSymlinks
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*) ./?%{QUERY_STRING}
При его использовании запрос идет в index.php, который выглядит так:
mb_internal_encoding("UTF-8");
require_once "lib/database_class.php";
require_once "lib/frontpagecontent_class.php";
require_once "lib/config_class.php";
$db = new DataBase();
$config = new Config();
$content = new FrontPageContent($db);
$url = "http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$path = parse_url($url, PHP_URL_PATH);
$path = strtolower(substr($path, 1));
$path = str_getcsv($path, "/");
$reg = "/^[0-9a-z-_]+$/i";
$tree = parse_ini_file("cache/tree.ini", true);
if (count($path) == 1) {
switch ($path[0]) {
case "": {
echo $content->getHeader($config->r_main);
echo $content->getContent($config->r_main);
echo $content->getFooter($config->r_main);
break;
}
case $config->r_catalog: {
echo $content->getHeader($config->r_catalog);
echo $content->getContent($config->r_catalog);
echo $content->getFooter();
break;
}
case $config->r_basket: {
echo $content->getHeader($config->r_basket);
echo $content->getContent($config->r_basket);
echo $content->getFooter();
break;
}
case $config->r_about: {
echo $content->getHeader($config->r_about);
echo $content->getContent($config->r_about);
echo $content->getFooter();
break;
}
case $config->r_news: {
echo $content->getHeader($config->r_news);
echo $content->getContent($config->r_news);
echo $content->getFooter();
break;
}
case $config->r_search: {
if (isset($_SESSION["search"])) {
echo $content->getHeader($config->r_search);
echo $content->getContent($config->r_search);
echo $content->getFooter();
unset($_SESSION["search"]);
}
else {
echo $content->getContent("404");
}
break;
}
default: {
echo $content->getContent("404");
}
}
Проблема в том, что у меня происходит куча подключений к базе данных:
101 Query SET lc_time_names = 'ru_RU'
101 Query SET NAMES 'utf8'
102 Connect root@localhost on new-nkrep
102 Query SET lc_time_names = 'ru_RU'
102 Query SET NAMES 'utf8'
103 Connect root@localhost on new-nkrep
103 Query SET lc_time_names = 'ru_RU'
103 Query SET NAMES 'utf8'
104 Connect root@localhost on new-nkrep
104 Query SET lc_time_names = 'ru_RU'
104 Query SET NAMES 'utf8'
106 Connect root@localhost on new-nkrep
106 Query SET lc_time_names = 'ru_RU'
106 Query SET NAMES 'utf8'
105 Connect root@localhost on new-nkrep
105 Query SET lc_time_names = 'ru_RU'
105 Query SET NAMES 'utf8'
107 Connect root@localhost on new-nkrep
107 Query SET lc_time_names = 'ru_RU'
107 Query SET NAMES 'utf8'
108 Connect root@localhost on new-nkrep
108 Query SET lc_time_names = 'ru_RU'
108 Query SET NAMES 'utf8'
109 Connect root@localhost on new-nkrep
109 Query SET lc_time_names = 'ru_RU'
109 Query SET NAMES 'utf8'
110 Connect root@localhost on new-nkrep
110 Query SET lc_time_names = 'ru_RU'
110 Query SET NAMES 'utf8'
111 Connect root@localhost on new-nkrep
111 Query SET lc_time_names = 'ru_RU'
111 Query SET NAMES 'utf8'
112 Connect root@localhost on new-nkrep
112 Query SET lc_time_names = 'ru_RU'
112 Query SET NAMES 'utf8'
113 Connect root@localhost on new-nkrep
113 Query SET lc_time_names = 'ru_RU'
113 Query SET NAMES 'utf8'
114 Connect root@localhost on new-nkrep
114 Query SET lc_time_names = 'ru_RU'
114 Query SET NAMES 'utf8'
115 Connect root@localhost on new-nkrep
115 Query SET lc_time_names = 'ru_RU'
115 Query SET NAMES 'utf8'
116 Connect root@localhost on new-nkrep
116 Query SET lc_time_names = 'ru_RU'
116 Query SET NAMES 'utf8'
117 Connect root@localhost on new-nkrep
117 Query SET lc_time_names = 'ru_RU'
117 Query SET NAMES 'utf8'
118 Connect root@localhost on new-nkrep
118 Query SET lc_time_names = 'ru_RU'
118 Query SET NAMES 'utf8'
119 Connect root@localhost on new-nkrep
119 Query SET lc_time_names = 'ru_RU'
119 Query SET NAMES 'utf8'
120 Connect root@localhost on new-nkrep
120 Query SET lc_time_names = 'ru_RU'
120 Query SET NAMES 'utf8'
121 Connect root@localhost on new-nkrep
121 Query SET lc_time_names = 'ru_RU'
121 Query SET NAMES 'utf8'
122 Connect root@localhost on new-nkrep
122 Query SET lc_time_names = 'ru_RU'
122 Query SET NAMES 'utf8'
123 Connect root@localhost on new-nkrep
123 Query SET lc_time_names = 'ru_RU'
123 Query SET NAMES 'utf8'
124 Connect root@localhost on new-nkrep
124 Query SET lc_time_names = 'ru_RU'
124 Query SET NAMES 'utf8'
125 Connect root@localhost on new-nkrep
125 Query SET lc_time_names = 'ru_RU'
125 Query SET NAMES 'utf8'
126 Connect root@localhost on new-nkrep
126 Query SET lc_time_names = 'ru_RU'
126 Query SET NAMES 'utf8'
127 Connect root@localhost on new-nkrep
127 Query SET lc_time_names = 'ru_RU'
127 Query SET NAMES 'utf8'
128 Connect root@localhost on new-nkrep
128 Query SET lc_time_names = 'ru_RU'
128 Query SET NAMES 'utf8'
129 Connect root@localhost on new-nkrep
129 Query SET lc_time_names = 'ru_RU'
129 Query SET NAMES 'utf8'
130 Connect root@localhost on new-nkrep
130 Query SET lc_time_names = 'ru_RU'
130 Query SET NAMES 'utf8'
Подскажите пожалуйста, с чем связано такое явление и как это исправить?