Server : LiteSpeed
System : Linux terra.hostitbro.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64
User : outerorb ( 1091)
PHP Version : 8.1.34
Disable Function : mail
Directory :  /home2/outerorb/public_html/

📁 Create New:
⬆️ Upload File:
Current Dir [ Writable ] Root [ Writable ]


OR Upload from URL:
URL: Save as:

📄 File: sitemap.php

Path: /home2/outerorb/public_html/sitemap.php

Size: 1.99 KB

Permissions: 0666

<?php
// Dynamic sitemap generator — outputs XML based on current host and site files
header('Content-Type: application/xml; charset=utf-8');
ob_start();
include __DIR__ . '/inc/config.php';
ob_end_clean();
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost';
$base = isset($base_url) ? rtrim($base_url, '/') : '';
if ($base === '' || !preg_match('#^https?://#i', $base)) {
  $base = $protocol . '://' . $host . '/' . ltrim($base, '/');
}
$base = rtrim($base, '/');
$excludedDirs = ['inc', 'assets', 'template-files', '.git', 'node_modules', 'vendor'];
$excludedFiles = ['sitemap.php', 'mailer.php', '404.php', 'coming-soon.php'];
$urls = [];
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator(__DIR__));
foreach ($it as $file) {
    if (!$file->isFile()) continue;
    if (strtolower($file->getExtension()) !== 'php') continue;
    $full = str_replace('\\', '/', $file->getPathname());
    $rel = ltrim(str_replace(str_replace('\\','/', __DIR__), '', $full), '/');
    // skip this generator and excluded dirs
    if (in_array($rel, $excludedFiles, true)) continue;
    $parts = explode('/', $rel);
    if (in_array($parts[0], $excludedDirs)) continue;
    // skip templates that look like includes (simple heuristic)
    if (strpos($rel, 'inc/') === 0) continue;
    $url = $base . '/' . ltrim($rel, '/');
    $urls[$url] = filemtime($full);
}
// sort by URL
ksort($urls);
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
echo "<?xml-stylesheet type=\"text/xsl\" href=\"sitemap.xsl\"?>\n";
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<?php foreach ($urls as $loc => $mod): ?>
  <url>
    <loc><?php echo htmlspecialchars($loc, ENT_QUOTES, 'UTF-8'); ?></loc>
    <lastmod><?php echo date('Y-m-d\TH:i:sP', $mod); ?></lastmod>
    <changefreq>weekly</changefreq>
    <priority>0.6</priority>
  </url>
<?php endforeach; ?>
</urlset>

← Back to Directory Edit File 🔒 Chmod

WP File Manager