下面的教程是针对wordpress博客如何加快百度收录自动提交sitemap。
步骤:
①新建一个空白txt文件,将下面的代码复制到文档中。
<?php
require('./wp-blog-header.php');
header('Content-type: application/txt');
header('HTTP/1.1 200 OK');
$posts_to_show = 500000; // 限制最大文章数量
?>https://suguoer.com
<?php
header("Content-type: text/txt");
$myposts = get_posts( "numberposts=" . $posts_to_show );
foreach( $myposts as $post ) { ?>
<?php the_permalink(); ?><?php echo "\n"; ?>
<?php } ?>
https://suguoer.com//换成自己的域名
②重命名文件为url.php(自定义名字),或者下载隐藏内用中的压缩包解压上传自定义目录即可。
③打开shell或者ssh执行以下命令/或者在宝塔面板/计划任务/shell脚本
wget -O /www/wwwroot/网站名/site.txt --no-check-certificate https://xxx.xxx.com/url.php
④执行后在根目录下会生成site.txt文本文件,文本中为网站所有的文章地址。⑤打开百度站长—>链接提交—>sitemap
⑥输入网站的site.txt的链接地址,例如:https://suguoer.com/site.txt输入验证码后提交即可。
总结:此操作节省了逐条提交网站链接的操作,由程序自动抓取生成,会节省大量的时间。加速百度收录。