// === CANONICAL / PLACEHOLDER LEAK REDIRECT (session_start'tan ÖNCE olmalı) === if (!headers_sent()) { // Redirect sadece GET/HEAD isteklerde olsun (POST login akışını bozmasın) $method = $_SERVER['REQUEST_METHOD'] ?? 'GET'; if ($method === 'GET' || $method === 'HEAD') { $uri = $_SERVER['REQUEST_URI'] ?? '/'; $path = parse_url($uri, PHP_URL_PATH) ?: '/'; $q = parse_url($uri, PHP_URL_QUERY); $query = $q ? ('?' . $q) : ''; // 1) Placeholder leak: SADECE {city_slug} / %7Bcity_slug%7D gibi "süslü parantezli" olanlar if ( preg_match('~(%7B|{)\s*(city|district|service)_slug\s*(%7D|})~i', $uri) || preg_match('~/(?:city|district|service)-slug(?:/|$)~i', $path) ) { header('Location: https://www.trendhizmet.com/', true, 301); exit; } // 2) Türkçe karakter / büyük harf normalize → canonical 301 (dosya olmayan sayfalarda) $decoded = rawurldecode($path); // sitemapv2.xml, robots.txt gibi dosyaları elleme if (strpos(basename($decoded), '.') === false) { $lower = mb_strtolower($decoded, 'UTF-8'); // TR → ASCII $lower = strtr($lower, [ 'ç'=>'c','ğ'=>'g','ı'=>'i','ö'=>'o','ş'=>'s','ü'=>'u', 'â'=>'a','î'=>'i','û'=>'u' ]); // slash kalsın; a-z 0-9 ve - harici her şeyi - yap $norm = preg_replace('~[^a-z0-9\/-]+~', '-', $lower); $norm = preg_replace('~-{2,}~', '-', $norm); $norm = preg_replace('~\/{2,}~', '/', $norm); $norm = rtrim($norm, '-'); if ($norm === '') $norm = '/'; // ✅ Çift şehir: /antalya-antalya-... → /antalya-... $norm = preg_replace('~^/([a-z0-9]+)-\1-~', '/$1-', $norm); // ✅ Çift ek: -sirketleri-sirketleri / -hizmetleri-hizmetleri / -firmalari-firmalari → tekleştir $norm = preg_replace('~-(sirketleri|hizmetleri|firmalari)(?:-\1)+(?=$|\/)~i', '-$1', $norm); if ($norm !== $decoded) { header('Location: https://www.trendhizmet.com' . $norm . $query, true, 301); exit; } if ($norm !== $decoded) { header('Location: https://www.trendhizmet.com' . $norm . $query, true, 301); exit; } } } } // ✅ AFYON ilçe sayfaları → il sayfasına 301 (Toplantı & Gala Organizasyonu) if (preg_match('~^/afyonkarahisar-[a-z0-9-]+-toplanti-ve-gala-gecesi-organizasyonu-sirketleri(?:-sirketleri)?/?$~i', $path)) { header('Location: https://www.trendhizmet.com/afyonkarahisar-toplanti-ve-gala-gecesi-organizasyonu-sirketleri', true, 301); exit; } // ✅ AFYON: "diger internet reklamciligi" ilçe/alt bölge sayfaları -> il sayfasına 301 if (preg_match('~^/afyonkarahisar-[a-z0-9-]+-diger-internet-reklamciligi-sirketleri/?$~i', $path)) { header('Location: https://www.trendhizmet.com/afyonkarahisar-diger-internet-reklamciligi-sirketleri', true, 301); exit; } // ✅ NOKTA ATIŞI: /giris-yap -> /ulogin if ($path === '/giris-yap' || $path === '/giris-yap/') { header('Location: https://www.trendhizmet.com/ulogin', true, 301); exit; } if (isset($redirect_map[$path_n])) { header('Location: https://www.trendhizmet.com' . $redirect_map[$path_n] . $query, true, 301); exit; } // ✅ NOKTA ATIŞI: sadece bu URL if ($path === '/ev-temizligi-sirketleri') { header('Location: https://www.trendhizmet.com/ev-temizligi', true, 301); exit; } session_start(); @date_default_timezone_set("Europe/Istanbul"); /*if(@$_GET['do'] == 'save')$_GET['sdbg']=1;*/ if(!empty($_GET["sdbg"])){ ini_set("display_errors","1"); error_reporting(E_ALL); } require "config.php"; require "class.sw.php"; /** * HTML çıktısı üzerinde son düzenlemeler. * - Placeholder leak temizliği * - Buss type'a göre ŞİRKETLERİ/HİZMETLERİ dönüşümü */ function print_html($html){ global $api, $service; // A) ✅ ÇİFT ŞEHİR / LOKASYON: /antalya-antalya-... → /antalya-... $html = preg_replace('~\/([a-z0-9]+)-\1-~i', '/$1-', $html); // B) ✅ ÇİFT EK: -sirketleri-sirketleri / -hizmetleri-hizmetleri / -firmalari-firmalari → tekleştir $html = preg_replace('~-(sirketleri|hizmetleri|firmalari)(?:-\1)+(?=[\/"\'?#]|$)~i', '-$1', $html); // C) Placeholder leak temizliği (sende vardı) $html = preg_replace('~%7B(?:city|district|service)_slug%7D~i', '', $html); $html = preg_replace('~\{(?:city|district|service)_slug\}~i', '', $html); $html = preg_replace('~/(?:%7B(?:city|district|service)_slug%7D|\{(?:city|district|service)_slug\})-~i', '/', $html); // D) Kırıntı düzelt $html = str_replace('/-', '/', $html); $html = preg_replace('~-{2,}~', '-', $html); // E) buss_type dönüşümü (sende vardı) if(!empty($service["meta"]["buss_type"])){ if($service["meta"]["buss_type"] == 1){ $replace = array("FİRMALARI","Firması","Firmaları","firmaları"); $html = str_replace(array("ŞİRKETLERİ","Şirketi","Şirketleri","şirketleri"), $replace, $html); }elseif($service["meta"]["buss_type"] == 2){ $replace = array("HİZMETLERİ","Hizmeti","Hizmetleri","hizmetleri"); $html = str_replace(array("ŞİRKETLERİ","Şirketi","Şirketleri","şirketleri"), $replace, $html); } } return $html; } try{ if(!empty($_COOKIE['user']) && empty($_SESSION['user'])){ $_SESSION['user'] = json_decode($_COOKIE['user'], true); } $api = new SW_SISTEM($CONFIG); $api->user_init(empty($_SESSION['user']) ? array() : $_SESSION["user"]); if(file_exists($api->page['theme']['path']."functions.php")){ include($api->page['theme']['path']."functions.php"); } if(!empty($api->option["plugins"])){ foreach($api->option["plugins"] as $plugin){ if(file_exists($api->option["DIR"]."/".$plugin["path_dir"])){ include($api->option["DIR"]."/".$plugin["path_dir"]); } } } $api->sw(); if(!empty($api->page["data"]["meta"]["redirect_url"])){ http_response_code(301); header("Location:".$api->page["data"]["meta"]["redirect_url"]); die; } if(!empty($api->page["redirect"])){ header("Location:".$api->page["redirect"]); die("Yönlendiriliyorsunuz.."); } if(!empty($api->page["html"])){ die($api->page["html"]); } $api->run_action(); @header("Content-Type:".$api->page["content_type"]."; charset=UTF-8"); ob_start(); include(file_exists($api->page['include_php']) ? $api->page['include_php'] : $api->page["theme_path"]."404.php"); $api->db->close(); if($api->page["content_type"] == "text/html"){ $html = ob_get_contents(); ob_end_clean(); echo print_html($html); } }catch (Exception $exc){ die($exc->getMessage()); } ?>