Решено Генерация XML-карты сайта

Статус
В этой теме нельзя размещать новые ответы.

evgen583

Проверенные
Сообщения
490
Реакции
41
Баллы
3,325
Здравствуйте,у меня такая проблема,почему то при генерации карты у меня скачивается вот такой фаил sitemap-1.xml а должен же быть так sitemap.xml
В чём может быть такая причина.
 
Так sitemap.php у меня почти пустой вот что в нем

Код:
<?php

$startTime = microtime(true);
$fileDir = dirname(__FILE__);

require($fileDir . '/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');

XenForo_Application::initialize($fileDir . '/library', $fileDir);
XenForo_Application::set('page_start_time', $startTime);

$dependencies = new XenForo_Dependencies_Public();
$dependencies->preLoadData();

/** @var XenForo_Model_Sitemap $sitemapModel */
$sitemapModel = XenForo_Model::create('XenForo_Model_Sitemap');
$sitemap = $sitemapModel->getCurrentSitemap();
if (!$sitemap)
{
    header('Content-Type: text/plain; charset=utf-8', true, 404);
    echo 'no sitemap';
    exit;
}

$counter = isset($_GET['c']) && is_string($_GET['c']) ? intval($_GET['c']) : null;

if (!$counter)
{
    if ($sitemap['file_count'] > 1)
    {
        header('Content-Type: application/xml; charset=utf-8');
        header('Content-Disposition: inline; filename="sitemap-index.xml"');
        echo $sitemapModel->buildSitemapIndex($sitemap);
        exit;
    }

    $counter = 1;
}

$fileName = $sitemapModel->getSitemapFileName($sitemap['sitemap_id'], $counter, $sitemap['is_compressed']);
if (file_exists($fileName))
{
    if ($sitemap['is_compressed'])
    {
        header('Content-Type: application/gzip; charset=utf-8');
        header('Content-Disposition: attachment; filename="sitemap-' . $counter . '.xml.gz"');
    }
    else
    {
        header('Content-Type: application/xml; charset=utf-8');
        header('Content-Disposition: inline; filename="sitemap-' . $counter . '.xml"');
    }

    readfile($fileName);
}
else
{
    header('Content-Type: text/plain; charset=utf-8', true, 404);
    echo 'invalid sitemap file';
}

А в sitemap-1.xml дальше не стал копировать

Код:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
    <url><loc>http://ohotarybalka24.ru/</loc></url>
    <url><loc>http://ohotarybalka24.ru/threads/grand-marin-mirovoj-lider-v-proizvodstve-malomernyx-sudov.4/</loc><lastmod>2015-09-11T15:13:34+00:00</lastmod></url>
    <url><loc>http://ohotarybalka24.ru/threads/prodam-kostjum-gorka-3k-bars-za-2300r-ot-proizvoditelja.5/</loc><lastmod>2015-07-04T13:39:53+00:00</lastmod></url>
    <url><loc>http://ohotarybalka24.ru/threads/kostjum-acu-multikam-ot-bars-i-ne-tolko-za-2800r.6/</loc><lastmod>2015-07-04T13:47:40+00:00</lastmod></url>
    <url><loc>http://ohotarybalka24.ru/threads/maskxalat-novogo-pokolenija-ratnik-dvuxstoronnij.7/</loc><lastmod>2015-07-04T13:51:17+00:00</lastmod></url>
    <url><loc>http://ohotarybalka24.ru/threads/kostjum-smok-m-ot-bars.8/</loc><lastmod>2015-07-04T13:58:32+00:00</lastmod></url>
    <url><loc>http://ohotarybalka24.ru/threads/prodam-kostjum-gorka-3k-bars-za-2300r-ot-proizvoditelja.9/</loc><lastmod>2015-07-04T14:01:55+00:00</lastmod></url>
    <url><loc>http://ohotarybalka24.ru/threads/kostjum-acu-multikam-ot-bars-i-ne-tolko.10/</loc><lastmod>2015-07-04T14:04:12+00:00</lastmod></url>
    <url><loc>http://ohotarybalka24.ru/threads/maskxalat-novogo-pokolenija-ratnik-dvuxstoronnij-ot-bars.11/</loc><lastmod>2015-07-04T14:05:21+00:00</lastmod></url>
    <url><loc>http://ohotarybalka24.ru/threads/kostjum-smok-m-ot-bars.12/</loc><lastmod>2015-07-04T14:06:54+00:00</lastmod></url>
    <url><loc>http://ohotarybalka24.ru/threads/kostjum-sumrak-m1-ot-bars.13/</loc><lastmod>2015-07-04T14:08:39+00:00</lastmod></url>
 
Так sitemap.php у меня почти пустой вот что в нем

Код:
<?php

$startTime = microtime(true);
$fileDir = dirname(__FILE__);

require($fileDir . '/library/XenForo/Autoloader.php');
XenForo_Autoloader::getInstance()->setupAutoloader($fileDir . '/library');

XenForo_Application::initialize($fileDir . '/library', $fileDir);
XenForo_Application::set('page_start_time', $startTime);

$dependencies = new XenForo_Dependencies_Public();
$dependencies->preLoadData();

/** @var XenForo_Model_Sitemap $sitemapModel */
$sitemapModel = XenForo_Model::create('XenForo_Model_Sitemap');
$sitemap = $sitemapModel->getCurrentSitemap();
if (!$sitemap)
{
    header('Content-Type: text/plain; charset=utf-8', true, 404);
    echo 'no sitemap';
    exit;
}

$counter = isset($_GET['c']) && is_string($_GET['c']) ? intval($_GET['c']) : null;

if (!$counter)
{
    if ($sitemap['file_count'] > 1)
    {
        header('Content-Type: application/xml; charset=utf-8');
        header('Content-Disposition: inline; filename="sitemap-index.xml"');
        echo $sitemapModel->buildSitemapIndex($sitemap);
        exit;
    }

    $counter = 1;
}

$fileName = $sitemapModel->getSitemapFileName($sitemap['sitemap_id'], $counter, $sitemap['is_compressed']);
if (file_exists($fileName))
{
    if ($sitemap['is_compressed'])
    {
        header('Content-Type: application/gzip; charset=utf-8');
        header('Content-Disposition: attachment; filename="sitemap-' . $counter . '.xml.gz"');
    }
    else
    {
        header('Content-Type: application/xml; charset=utf-8');
        header('Content-Disposition: inline; filename="sitemap-' . $counter . '.xml"');
    }

    readfile($fileName);
}
else
{
    header('Content-Type: text/plain; charset=utf-8', true, 404);
    echo 'invalid sitemap file';
}

А в sitemap-1.xml дальше не стал копировать

Код:
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1">
    <url><loc>http://ohotarybalka24.ru/</loc></url>
    <url><loc>http://ohotarybalka24.ru/threads/grand-marin-mirovoj-lider-v-proizvodstve-malomernyx-sudov.4/</loc><lastmod>2015-09-11T15:13:34+00:00</lastmod></url>
    <url><loc>http://ohotarybalka24.ru/threads/prodam-kostjum-gorka-3k-bars-za-2300r-ot-proizvoditelja.5/</loc><lastmod>2015-07-04T13:39:53+00:00</lastmod></url>
    <url><loc>http://ohotarybalka24.ru/threads/kostjum-acu-multikam-ot-bars-i-ne-tolko-za-2800r.6/</loc><lastmod>2015-07-04T13:47:40+00:00</lastmod></url>
    <url><loc>http://ohotarybalka24.ru/threads/maskxalat-novogo-pokolenija-ratnik-dvuxstoronnij.7/</loc><lastmod>2015-07-04T13:51:17+00:00</lastmod></url>
    <url><loc>http://ohotarybalka24.ru/threads/kostjum-smok-m-ot-bars.8/</loc><lastmod>2015-07-04T13:58:32+00:00</lastmod></url>
    <url><loc>http://ohotarybalka24.ru/threads/prodam-kostjum-gorka-3k-bars-za-2300r-ot-proizvoditelja.9/</loc><lastmod>2015-07-04T14:01:55+00:00</lastmod></url>
    <url><loc>http://ohotarybalka24.ru/threads/kostjum-acu-multikam-ot-bars-i-ne-tolko.10/</loc><lastmod>2015-07-04T14:04:12+00:00</lastmod></url>
    <url><loc>http://ohotarybalka24.ru/threads/maskxalat-novogo-pokolenija-ratnik-dvuxstoronnij-ot-bars.11/</loc><lastmod>2015-07-04T14:05:21+00:00</lastmod></url>
    <url><loc>http://ohotarybalka24.ru/threads/kostjum-smok-m-ot-bars.12/</loc><lastmod>2015-07-04T14:06:54+00:00</lastmod></url>
    <url><loc>http://ohotarybalka24.ru/threads/kostjum-sumrak-m1-ot-bars.13/</loc><lastmod>2015-07-04T14:08:39+00:00</lastmod></url>
И зачем вам это?
 
  • Мне нравится
Реакции: Hope
Статус
В этой теме нельзя размещать новые ответы.
Современный облачный хостинг провайдер | Aéza
Назад
Сверху Снизу