本站所有内容仅限用于学习和研究目的,如有侵权请邮件与我们联系处理!
世上事本无难易,为之则易!

网站首页 站群教程 原创站群教程 正文

搜狗站群sitemap:地图中仅包含当前域名升级版

曹操 2021-06-24 原创站群教程 2484 ℃ 0 评论 3375字 free 收藏

为了能在某些XML地图推送泛二级域名时,实现目标域名的主域名的在搜狗收录的目的,特此基于《站群sitemap:地图中仅包含当前域名》升级改造出这个版本的sitemap文件。

伪静态

rewrite ^/(.*).xml$ /sitemap.php?id=$1;

sitemap.php

<?php
//error_reporting(0);
$arr = explode("/", $_SERVER['REQUEST_URI']);
$num = sizeof($arr);
header("Content-Type: text/xml");
$map = "\t<urlset>\r\n";
$arrhost = explode(".",$_SERVER['HTTP_HOST']);
$date = date("Y-m-d");
if($arrhost['2']!=''){
//根域名+wwww
    $host = 'http://www.' .$arrhost['1'].'.'.$arrhost['2'].'/';
    $map.= "\t\t<url>\n";
    $map.= "\t\t\t<loc>{$host}</loc>\r\n";
    $map.= "\t\t\t<priority>{$date}</priority>\r\n";
    $map.= "\t\t\t<lastmod>daily</lastmod>\r\n";
    $map.= "\t\t\t<changefreq>0.8</changefreq>\r\n";
    $map.= "\t\t</url>\n";
//根域名
    $host = 'http://' .$arrhost['1'].'.'.$arrhost['2'].'/';
    $map.= "\t\t<url>\n";
    $map.= "\t\t\t<loc>{$host}</loc>\r\n";
    $map.= "\t\t\t<priority>{$date}</priority>\r\n";
    $map.= "\t\t\t<lastmod>daily</lastmod>\r\n";
    $map.= "\t\t\t<changefreq>0.8</changefreq>\r\n";
    $map.= "\t\t</url>\n";
}else{
//根域名+wwww
    $host = 'http://www.' .$arrhost['0'].'.'.$arrhost['1'].'/';
    $map.= "\t\t<url>\n";
    $map.= "\t\t\t<loc>{$host}</loc>\r\n";
    $map.= "\t\t\t<priority>{$date}</priority>\r\n";
    $map.= "\t\t\t<lastmod>daily</lastmod>\r\n";
    $map.= "\t\t\t<changefreq>0.8</changefreq>\r\n";
    $map.= "\t\t</url>\n";
//根域名
    $host = 'http://' .$arrhost['0'].'.'.$arrhost['1'].'/';
    $map.= "\t\t<url>\n";
    $map.= "\t\t\t<loc>{$host}</loc>\r\n";
    $map.= "\t\t\t<priority>{$date}</priority>\r\n";
    $map.= "\t\t\t<lastmod>daily</lastmod>\r\n";
    $map.= "\t\t\t<changefreq>0.8</changefreq>\r\n";
    $map.= "\t\t</url>\n";
}
$map.= "\t</urlset>";
echo $map;
die;
?>
目录导航
  • 伪静态
  • sitemap.php

  • Tags:链接提取sitemap提交网站地图生成

    必看说明

    • 本站中所有被研究的素材与信息全部来源于互联网,版权争议与本站无关。
    • 本站文章或仅为文本内容原创,非程序原创。如有侵权、不妥之处,请联系站长第一时间删除。敬请谅解!
    • 本站所有内容严格遵守国家法律的条例,所有研究的算法技术均来源于搜索引擎公开默认允许用户研究使用的接口。
    • 阅读本文及获取资源前,请确保您已充分阅读并理解《访问曹操SEO网站需知:行为准则》。
    • 本站分享的任何工具、程序仅供学习参考编写架构,仅可在本地的虚拟机内断网测试,严禁联网运行或上传搭建!
    • 任何资源必须在下载后24个小时内,从电脑中彻底删除。不得传播或者用于其他任何用途!否则一切后果用户自负!
    • 转载请注明 : 文章转载自  曹操SEO 搜狗站群sitemap:地图中仅包含当前域名升级版
    • 本文标题:《搜狗站群sitemap:地图中仅包含当前域名升级版》
    • 本文链接:https://www.ccooc.cn/1459.html

    本文暂时没有评论,来添加一个吧(●'◡'●)

    欢迎 发表评论:

    网站分类
    近期评论
    文章归档
    标签列表
    站点信息
    • 文章总数:2011
    • 页面总数:7
    • 分类总数:46
    • 标签总数:337
    • 评论总数:8738
    • 浏览总数:5101102