. * */ namespace Vvveb\Controller\Feed; use Vvveb\Controller\Base; class Robots extends Base { function index() { $text = ''; $robots = DIR_PUBLIC . 'vrobots.txt'; if (file_exists($robots)) { $text = @file_get_contents($robots); } $host = ' https://' . $_SERVER['HTTP_HOST'] ?? '' . (V_SUBDIR_INSTALL ? V_SUBDIR_INSTALL : ''); // change sitemap urls to absolute if ($host) { $text = preg_replace('@(sitemap):\s+/@', "$1: $host/", $text); } $this->response->setType('text'); $this->response->output($text); } }