在《零距离泛目录kevin至尊版》的说明文件中,有提示:需要设置404错误页为404.php,否则内页打不开。
error_page 404 =200 /404.php;
源程序给出的泛目录xml地图代码泛目录代码如下,只能显示一个xml地图。
<?php $arr = explode("/",$_SERVER['REQUEST_URI']); $num = sizeof($arr); if($arr[$num - 1] == 'sitemap.xml'){ header("Content-Type: text/xml"); $map = "\t<urlset>\r\n"; $host = 'http://'.$_SERVER['HTTP_HOST'].'/xml/'; $date = date("Y-m-d"); for($i=0;$i<1000;$i++){ $tmp = $host.mt_rand(10000,999999999).'.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; } header("Content-Type: text/html;charset=gb2312"); ?>
如需一次性提交多个百度地图,可以使用到。
我们只需要修改程序根目录下的404.php第14行。
修改如下代码:
if($arr[$num - 1] == 'sitemap.xml'){
替换为:
$str =$arr[$num - 1]; $pattern = '/(\d*\d+)/'; preg_match_all($pattern, $str, $match); $lingdumap= 'sitemap'.$match['0']['0'].'.xml'; if($arr[$num - 1] == $lingdumap){
即可打开您域名/sitemap[这里是任意数字].xml的网站地图了。
修改过的程序已打包,并同时修正其他一些错误!并已上传到原下载链接内!