Skip to content

Commit

Permalink
Simplified http protocol detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Matix-Media committed Jul 27, 2020
1 parent b629887 commit 25ec73d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions requires/Route.php
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,14 @@ public static function generate_sitemap($cast_methods = ["GET"], $last_mod = "Y-
$xml = new SimpleXMLElement("<urlset />");
$xml->addAttribute("xmlns", "http://www.sitemaps.org/schemas/sitemap/0.9");

// Get HTTP Protocol
$protocol = "http://";
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
$protocol = "https://";
}

// Generating base path
$base = $protocol = strtolower(substr($_SERVER["SERVER_PROTOCOL"], 0, strpos($_SERVER["SERVER_PROTOCOL"], '/'))) .
'://' . $_SERVER["HTTP_HOST"];
$base = $protocol . $_SERVER["HTTP_HOST"];

// Iterating over sites
foreach (self::$routes as $route) {
Expand Down

0 comments on commit 25ec73d

Please sign in to comment.