fix sitemap gen (proto select)
This commit is contained in:
parent
e3a251b8fe
commit
3f63c3bccb
1 changed files with 2 additions and 2 deletions
|
@ -348,15 +348,15 @@ if (isset($_GET['exportopml'])) // OPML
|
||||||
if (isset($_GET['sitemap']))
|
if (isset($_GET['sitemap']))
|
||||||
{
|
{
|
||||||
header('Content-Type: application/xml');
|
header('Content-Type: application/xml');
|
||||||
|
$proto=(!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS'])=='on')?"https://":"http://";
|
||||||
echo '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
|
echo '<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
|
||||||
echo '<url><loc>'.'http' . (!empty($_SERVER['HTTPS']) ? 's' : '')."://{$_SERVER['HTTP_HOST']}".str_replace('?sitemap', '', $_SERVER['REQUEST_URI'])."</loc>\n";
|
echo '<url><loc>'.$proto."{$_SERVER['HTTP_HOST']}".str_replace('?sitemap', '', $_SERVER['REQUEST_URI'])."</loc>\n";
|
||||||
echo '<lastmod>'.date('c', time())."</lastmod>\n";
|
echo '<lastmod>'.date('c', time())."</lastmod>\n";
|
||||||
echo '<changefreq>daily</changefreq></url>';
|
echo '<changefreq>daily</changefreq></url>';
|
||||||
$subdirs = glob(AUTOBLOGS_FOLDER . "*");
|
$subdirs = glob(AUTOBLOGS_FOLDER . "*");
|
||||||
foreach($subdirs as $unit) {
|
foreach($subdirs as $unit) {
|
||||||
if(is_dir($unit)) {
|
if(is_dir($unit)) {
|
||||||
$unit=substr($unit, 2);
|
$unit=substr($unit, 2);
|
||||||
$proto=(!empty($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS'])=='on')?"https://":"http://";
|
|
||||||
echo '<url><loc>'.$proto.$_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'], 0, -9)."$unit/"."</loc>\n";
|
echo '<url><loc>'.$proto.$_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'], 0, -9)."$unit/"."</loc>\n";
|
||||||
echo '<lastmod>'.date('c', filemtime($unit))."</lastmod>\n";
|
echo '<lastmod>'.date('c', filemtime($unit))."</lastmod>\n";
|
||||||
echo '<changefreq>hourly</changefreq></url>';
|
echo '<changefreq>hourly</changefreq></url>';
|
||||||
|
|
Loading…
Reference in a new issue