<?php
//echo $_SERVER['HTTP_HOST'];var_dump($_SERVER);
header("Content-type: text/xml");

// Определяем запрошенный файл sitemap
$request_uri = $_SERVER['REQUEST_URI'];
$sitemap_file = basename(parse_url($request_uri, PHP_URL_PATH));

// Если файл не найден, используем sitemap.xml по умолчанию
if (!file_exists($sitemap_file)) {
    $sitemap_file = "sitemap.xml";
}

$sitemap_link = file_get_contents($sitemap_file);
$res = str_replace("www.gurtiz.ru", $_SERVER['SERVER_NAME'], $sitemap_link);
echo $res;
?>