实际上之前发过一篇类似的文章《给站群程序添加网站地图功能》,这个和那篇文章的内容差不多。
重新发一遍,因为这次要连续发好几篇关于站群地图生成的文章,仅作个人备份。
伪静态
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"; $host = "http://" . $_SERVER['HTTP_HOST'] . "/"; $date = date("Y-m-d"); //生成链接的条数以及规则 for ($i = 0; $i < 500; $i++) { $tmp = $host . 'books/'. mt_rand(10000, 99999999) . '.html'; $map.= "\t\t<url>\n"; $map.= "\t\t\t<loc>{$tmp}</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; ?>
本站所有内容仅限用于学习和研究目的,程序仅供本地断网测试,转载请说明出处!
站群SEO » 搜狗站群sitemap:生成当前域名的泛目录链接
站群SEO » 搜狗站群sitemap:生成当前域名的泛目录链接