关注安徽站长创业、网站优化、网站推广及搜索引擎优化(SEO)的自媒体平台,分享最新的seo和网站优化知识

AKCMS 4.3为网站每个栏目都制作XML地图sitemap.xml

发布:雷都SEO2023-3-20 9:07分类: akcms使用手册

我的网站栏目细分后一般会超过50个,搜索引擎蜘蛛抓取栏目分页不给力,栏目下数据多了,老数据就埋藏在数据库中很难得到曝光。因此有必要给每个栏目都制作一个网站地图sitemap.xml,有利于搜索引擎蜘蛛抓取数据。


我的思路是,先给每个栏目创建地图,然后再站点地图索引文件。


第一步,制作一个栏目地图模板sitemap.htm,请务必保存为UTF-8格式!


<?xml version="1.0" encoding="UTF-8"?>

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

   <{getitems num="500" orderby="id_reverse" category=$category template="

   <url>

       <loc>[url]</loc>

       <lastmod>[y]-[m]-[d]</lastmod>

       <changefreq>weekly</changefreq>

       <priority>0.8</priority>

   </url>"}>

</urlset>

第二步,创建一个category_rss.php文件放在根目录下,填充内容如下:


<?php

   $template ='sitemap.htm';

   include('akcms_category.php');

?>

第三步,/category_rss.php?id=1 就是你栏目ID=1的地图了


第四步,把栏目地图的URL伪静态为.xml类格式,在.htaccess中加一句:


RewriteRule ^category_([0-9]+).xml$ category_rss.php?id=$1 [L]

那么,你的栏目1的地图地址就是 /category_1.xml


下面制作所有栏目地图的索引文件:


第一步,制作一个索引文件模板sitemap_all.htm,请务必保存为UTF-8格式!


<?xml version="1.0" encoding="UTF-8"?>

<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

   <{getcategories num="500" template="

       <sitemap>

           <loc>http://www.xxoo.com/sitemap_[categoryid].xml</loc>

       </sitemap>"

   }>

</sitemapindex>

第二步,创建一个category_all.php文件放在根目录下,填充内容如下:


<?php

   $template ='sitemap_all.htm';

   include("akcms_page.php");

?>

第三步,/category_all.php 就是你站点地图索引文件。


第四步,把地图索引文件的URL伪静态为.xml类格式,在.htaccess中加一句:


RewriteRule ^sitemap.xml$ sitemap_all.php [L]

第五步,你的全站地图文件就是 http://www.xxoo.com/sitemap.xml


最后你可以把sitemap放在robots.txt里:


User-agent: *

Allow: /

Sitemap: http://www.xxoo.com/sitemap.xml

【AKCMS建站交流QQ群:174110734】

转载请注明:本文《AKCMS 4.3为网站每个栏目都制作XML地图sitemap.xml》链接: http://seo.leidu.net/post-463.html

百度已收录

已有 0/74 人参与

发表评论:

欢迎分享合肥SEO自媒体

合肥网站SEO

欢迎使用手机扫描访问本站,还可以关注微信哦~