<?$APPLICATION->IncludeComponent( "webfly:meta.edit", ".default", array( "CACHE_TYPE" => "A", "CACHE_TIME" => "3600", "WF_JQUERY" => "N" ), false );?> |
<?$APPLICATION->IncludeComponent( "webfly:meta.edit", ".default", array( "CACHE_TYPE" => "A", "CACHE_TIME" => "3600", "WF_JQUERY" => "N" ), false );?> |
<?$APPLICATION->IncludeComponent( "webfly:cities.popup", ".default", array( "COMPONENT_TEMPLATE" => ".default", "CACHE_TYPE" => "A", "CACHE_TIME" => "3600", ), false );?> |
<? if (CModule::IncludeModule("webfly.seocities") and CModule::IncludeModule("iblock")) { $cityID = CSeoCities::getCityId(); global $cityFilter; $cityFilter = array("!ID" => CIBlockElement::SubQuery("ID", array("IBLOCK_ID" => "ID_ИНФОБЛОКА", "PROPERTY_NOT_SHOW_IN_CITIES" => $cityID))); } ?> |
RewriteCond %{HTTP_HOST} msk.site.ru$ Rewriterule ^robots.txt$ /robots/robots_msk.txt [L] RewriteCond %{HTTP_HOST} spb.site.ru$ Rewriterule ^robots.txt$ /robots/robots_spb.txt [L] RewriteCond %{HTTP_HOST} site.ru$ Rewriterule ^robots.txt$ /robots/robots.txt [L] |
RewriteCond %{HTTP_HOST} msk\.site.ru Rewriterule ^robots.txt$ /robots/robots_msk.txt [L] RewriteCond %{HTTP_HOST} spb\.site.ru Rewriterule ^robots.txt$ /robots/robots_spb.txt [L] RewriteCond %{HTTP_HOST} site.ru Rewriterule ^robots.txt$ /robots/robots.txt [L] |
Правило переадресации для .htaccess
# 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] # robots.txt with robots.php only if the latter exists RewriteCond %{REQUEST_FILENAME} robots.txt RewriteCond %{DOCUMENT_ROOT}/robots.php -f RewriteRule ^(.*)$ /robots.php [L] |
Создаем общий файл robots.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); $fs = filesize($file) + 1000; header('Content-Type: text/plain'); header('Content-Length: '.$fs); header("Last-Modified: $tsstring"); header("ETag: \"{$etag}\""); $fc = file_get_contents($file); if($_SERVER['HTTP_HOST']!="himgroup.ru"){ echo "User-agent: Googlebot\nDisallow: /\n\n" . $fc; } else { echo $fc; } return true;}$robotsHost = dirname(__FILE__) . "/regions/robots/robots_{$hostname}.txt"; $robotsDefault = dirname(__FILE__) . "/robots.txt"; if(!echoTextFile($robotsHost) && !echoTextFile($robotsDefault)) { header('HTTP/1.0 404 Not Found');} |
Создаем общий файл 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__) . "/regions/sitemap/sitemap_{$hostname}.xml"; $sitemapDefault = dirname(__FILE__) . "/sitemap.xml"; if(!echoTextFile($sitemapHost) && !echoTextFile($sitemapDefault)) { header('HTTP/1.0 404 Not Found'); } |
Внимание! Повторная установка в демо-режиме приведет к окончанию демо‑режима и невозможности использовать модуль.