Задать вопрос
@txname

Региональность в Bitrix Апро Некст. Как создать sitemap.xml?

Всем привет!
Имеется сайт (интернет-магазин), установлено решение Аспро:Next
Изначально работали на одном домене site.ru
Все работало без ошибок, sitemap в т.ч. все было ОК.
Т.е. по адресу site.ru/sitemap.xml выдавалась правильная карта.

Недавно было решено сделать региональность.
Режим - на поддоменах gorod.site.ru

Все было сделано по инструкции, региональность работает, но .... (официальная инструкция - https://aspro.ru/docs/course/course36/chapter0896/...

После активации региональности и всех необходимых настроек, была запущена процедура пересоздания файлов sitemap и robots для всех поддоменов, в инструкции написано, что делает эта процедура - https://aspro.ru/docs/course/course36/lesson901/?L...

https://take.ms/n7UHE

Файлы карты скопировались для каждого региона в нужную папку (скрин прикрепил)

https://take.ms/Geky0

После выполнения этой процедуры, в корневой папке сайта создалось несколько файлов с расширением .php (скрин прикрепил)
Но! Они имеют нулевой размер, они все пустые!

https://take.ms/ZAtw6

Кроме того, изменился файл htaccess (так и должно быть), он должен теперь в зависимости от поддомена отдавать правильный sitemap

Options -Indexes
ErrorDocument 404 /404.php


<IfModule mod_php5.c>
   php_flag allow_call_time_pass_reference 1
   php_flag session.use_trans_sid off


   #php_value display_errors 1


  #php_value mbstring.internal_encoding UTF-8
</IfModule>


<IfModule mod_rewrite.c>


   Options +FollowSymLinks
   RewriteEngine On


   # ASPRO_SITEMAP_sitemap_index Serve sitemap.xml with sitemap.php only if the latter exists
   RewriteCond %{REQUEST_FILENAME} sitemap_index.xml
   RewriteCond %{DOCUMENT_ROOT}/sitemap_index.php -f
   RewriteRule ^(.*)$ /sitemap_index.php [L]


   # ASPRO_SITEMAP_sitemap_iblock_9 Serve sitemap.xml with sitemap.php only if the latter exists
   RewriteCond %{REQUEST_FILENAME} sitemap_iblock_9.xml
   RewriteCond %{DOCUMENT_ROOT}/sitemap_iblock_9.php -f
   RewriteRule ^(.*)$ /sitemap_iblock_9.php [L]


   # ASPRO_SITEMAP_sitemap_iblock_3 Serve sitemap.xml with sitemap.php only if the latter exists
   RewriteCond %{REQUEST_FILENAME} sitemap_iblock_3.xml
   RewriteCond %{DOCUMENT_ROOT}/sitemap_iblock_3.php -f
   RewriteRule ^(.*)$ /sitemap_iblock_3.php [L]


   # ASPRO_SITEMAP_sitemap_iblock_22 Serve sitemap.xml with sitemap.php only if the latter exists
   RewriteCond %{REQUEST_FILENAME} sitemap_iblock_22.xml
   RewriteCond %{DOCUMENT_ROOT}/sitemap_iblock_22.php -f
   RewriteRule ^(.*)$ /sitemap_iblock_22.php [L]


   # ASPRO_SITEMAP_sitemap_iblock_19 Serve sitemap.xml with sitemap.php only if the latter exists
   RewriteCond %{REQUEST_FILENAME} sitemap_iblock_19.xml
   RewriteCond %{DOCUMENT_ROOT}/sitemap_iblock_19.php -f
   RewriteRule ^(.*)$ /sitemap_iblock_19.php [L]


   # ASPRO_SITEMAP_sitemap_iblock_18 Serve sitemap.xml with sitemap.php only if the latter exists
   RewriteCond %{REQUEST_FILENAME} sitemap_iblock_18.xml
   RewriteCond %{DOCUMENT_ROOT}/sitemap_iblock_18.php -f
   RewriteRule ^(.*)$ /sitemap_iblock_18.php [L]


   # ASPRO_SITEMAP_sitemap_iblock_17 Serve sitemap.xml with sitemap.php only if the latter exists
   RewriteCond %{REQUEST_FILENAME} sitemap_iblock_17.xml
   RewriteCond %{DOCUMENT_ROOT}/sitemap_iblock_17.php -f
   RewriteRule ^(.*)$ /sitemap_iblock_17.php [L]


   # ASPRO_SITEMAP_sitemap_iblock_15 Serve sitemap.xml with sitemap.php only if the latter exists
   RewriteCond %{REQUEST_FILENAME} sitemap_iblock_15.xml
   RewriteCond %{DOCUMENT_ROOT}/sitemap_iblock_15.php -f
   RewriteRule ^(.*)$ /sitemap_iblock_15.php [L]


   # ASPRO_SITEMAP_sitemap_iblock_14 Serve sitemap.xml with sitemap.php only if the latter exists
   RewriteCond %{REQUEST_FILENAME} sitemap_iblock_14.xml
   RewriteCond %{DOCUMENT_ROOT}/sitemap_iblock_14.php -f
   RewriteRule ^(.*)$ /sitemap_iblock_14.php [L]


   # ASPRO_SITEMAP_sitemap_iblock_12 Serve sitemap.xml with sitemap.php only if the latter exists
   RewriteCond %{REQUEST_FILENAME} sitemap_iblock_12.xml
   RewriteCond %{DOCUMENT_ROOT}/sitemap_iblock_12.php -f
   RewriteRule ^(.*)$ /sitemap_iblock_12.php [L]


   # ASPRO_SITEMAP_sitemap_iblock_11 Serve sitemap.xml with sitemap.php only if the latter exists
   RewriteCond %{REQUEST_FILENAME} sitemap_iblock_11.xml
   RewriteCond %{DOCUMENT_ROOT}/sitemap_iblock_11.php -f
   RewriteRule ^(.*)$ /sitemap_iblock_11.php [L]


   # ASPRO_SITEMAP_sitemap_iblock_10 Serve sitemap.xml with sitemap.php only if the latter exists
   RewriteCond %{REQUEST_FILENAME} sitemap_iblock_10.xml
   RewriteCond %{DOCUMENT_ROOT}/sitemap_iblock_10.php -f
   RewriteRule ^(.*)$ /sitemap_iblock_10.php [L]


   # ASPRO_SITEMAP_sitemap_forum_1 Serve sitemap.xml with sitemap.php only if the latter exists
   RewriteCond %{REQUEST_FILENAME} sitemap_forum_1.xml
   RewriteCond %{DOCUMENT_ROOT}/sitemap_forum_1.php -f
   RewriteRule ^(.*)$ /sitemap_forum_1.php [L]


   # ASPRO_SITEMAP_sitemap_files Serve sitemap.xml with sitemap.php only if the latter exists
   RewriteCond %{REQUEST_FILENAME} sitemap_files.xml
   RewriteCond %{DOCUMENT_ROOT}/sitemap_files.php -f
   RewriteRule ^(.*)$ /sitemap_files.php [L]


   # ASPRO_SITEMAP_sitemap_errors Serve sitemap.xml with sitemap.php only if the latter exists
   RewriteCond %{REQUEST_FILENAME} sitemap_errors.xml
   RewriteCond %{DOCUMENT_ROOT}/sitemap_errors.php -f
   RewriteRule ^(.*)$ /sitemap_errors.php [L]


   # ASPRO_SITEMAP_sitemap Serve sitemap.xml with sitemap.php only if the latter exists
   RewriteCond %{REQUEST_FILENAME} sitemap.xml
   RewriteCond %{DOCUMENT_ROOT}/sitemap.php -f
   RewriteRule ^(.*)$ /sitemap.php [L]


   # ASPRO_ROBOTS Serve sitemap.xml with sitemap.php only if the latter exists
   RewriteCond %{REQUEST_FILENAME} robots.txt
   RewriteCond %{DOCUMENT_ROOT}/robots.php -f
   RewriteRule ^(.*)$ /robots.php [L]


   RewriteCond %{REQUEST_FILENAME} !-f
   RewriteCond %{REQUEST_FILENAME} !-l
   RewriteCond %{REQUEST_FILENAME} !-d
   RewriteCond %{REQUEST_FILENAME} !/bitrix/urlrewrite.php$
   RewriteRule ^(.*)$ /bitrix/urlrewrite.php [L]
   RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization}]
</IfModule>


<IfModule mod_dir.c>
   DirectoryIndex index.php index.html
</IfModule>


<IfModule mod_expires.c>
   ExpiresActive on
   ExpiresByType image/jpeg "access plus 3 day"
   ExpiresByType image/gif "access plus 3 day"
</IfModule>


В результате всего этого, сейчас при открытии site.ru/sitemap.XML или site.ru/sitemap.PHP или gorod.site.ru/sitemap.XML

открывается пустая страница, так-как htaccess отдает sitemap.PHP (а они пустые)

Собственно вопрос ...

Подскажите пожалуйста, где может быть ошибка, где искать? Как мне кажется я уже перерыл и проблема не решилась.

Заранее благодарен за любую помощь!
  • Вопрос задан
  • 2170 просмотров
Подписаться 1 Средний 2 комментария
Помогут разобраться в теме Все курсы
  • Нетология
    Фронтенд-разработчик
    11 месяцев
    Далее
  • Skillfactory
    DevOps-инженер
    6 месяцев
    Далее
  • SF Education
    Бизнес-аналитик
    11 месяцев
    Далее
Пригласить эксперта
Ответы на вопрос 2
alexyarik
@alexyarik
Битрикс разработчик
Если активность решения Аспро есть, обращаетесь в поддержку этого продукта, если нету покупаете продление
Ответ написан
Комментировать
@fertem1223
Просто добавь в пустой файл sitemap.php следующие <?
$arHost = explode( ":", $_SERVER["HTTP_HOST"]);
$_SERVER["HTTP_HOST"] = $arHost[0];
$hostname = $_SERVER['HTTP_HOST'];

function echoTextFile($file) {
if (! file_exists($file)) return false;
if (! is_readable($file)) return false;

$timestamp = filemtime($file);
$tsstring = gmdate('D, d M Y H:i:s ', $timestamp) . 'GMT';
$etag = md5($file . $timestamp);

header('Content-Type: application/xml');
header('Content-Length: '.filesize($file));
header("Last-Modified: $tsstring");
header("ETag: \"{$etag}\"");

readfile($file);

return true;
}

$sitemapHost = dirname(__FILE__) . "/aspro_regions/sitemap/sitemap_{$hostname}.xml";
$sitemapDefault = dirname(__FILE__) . "/sitemap.xml";

if(!echoTextFile($sitemapHost) && !echoTextFile($sitemapDefault))
{
header('HTTP/1.0 404 Not Found');
}
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы