21 lines
878 B
PHP
21 lines
878 B
PHP
<?php
|
|
// Dynamische Sitemap: gibt absolute URLs anhand des tatsaechlichen Request-
|
|
// Hosts aus, damit sie unabhaengig von der Domain (Marketing-Domain, Test-
|
|
// umgebung) immer korrekt ist. Per .htaccess auch unter /sitemap.xml erreichbar.
|
|
require_once __DIR__ . '/app/bootstrap.php';
|
|
|
|
$scheme = app_is_https() ? 'https' : 'http';
|
|
$host = (string)($_SERVER['HTTP_HOST'] ?? '');
|
|
$base = $host !== '' ? $scheme . '://' . $host : '';
|
|
|
|
$pages = ['', 'preise.php', 'impressum.php', 'agb.php', 'datenschutz.php'];
|
|
|
|
header('Content-Type: application/xml; charset=utf-8');
|
|
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
|
|
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";
|
|
foreach ($pages as $page) {
|
|
$loc = $base . '/' . $page;
|
|
echo ' <url><loc>' . htmlspecialchars($loc, ENT_QUOTES, 'UTF-8') . '</loc></url>' . "\n";
|
|
}
|
|
echo '</urlset>' . "\n";
|