 my site has a wordpress blog on it but it does not power the whole site just the blog if my entire site were powered by wordpress then i could generate a sitemap for google using wordpress functions i did not want to have wordpress control everything i wanted to have more control by doing some quick queries you can generate a sitemap for google that has all of your blog entries in it setting it up first you will need to send the correct headers create the opening xml tag and connect to your database php header content type text xml charset=iso 8859 1 echo xml version= 1 0 encoding= utf 8 urlset xmlns= http www sitemaps org schemas sitemap 0 9 require once db connection goes here this is where i would require my db connection file if you are not sure how to connect to your database you will need to contact your host to get that information and then do a search for php mysql connection if you cant figure it out still let me know and i can help get the categories next we want to query the database to get the categories used in wordpress $query = select cat id category nicename from wp categories order by category nicename $result = mysql query $query then we need to loop through the categories and display a url entry for each category while $row = mysql fetch array $result mysql assoc echo url loc trevor davis com blog $row category nicename loc changefreqweekly changefreq url get the entries next we need to create a query to return all of the entries for each category $artquery = select p post name date format p post date %y %m %d as createdon from wp posts as p wp categories as cat wp post2cat as pc where p id = pc post id and pc category id = $row cat id group by p id order by p id desc $artresult = mysql query $artquery finally we want to create a url entry for each blog entry while $artrow = mysql fetch array $artresult mysql assoc echo url loc trevor davis com blog $row category nicename $artrow post name php loc lastmod $artrow createdon lastmod changefreqweekly changefreq url to finish it off we just close everything up echo urlset the whole script here is the finished script php header content type text xml charset=iso 8859 1 echo xml version= 1 0 encoding= utf 8 urlset xmlns= http www sitemaps org schemas sitemap 0 9 require once db connection goes here this is where i would require my db connection file $query = select cat id category nicename from wp categories order by category nicename $result = mysql query $query while $row = mysql fetch array $result mysql assoc echo url loc trevor davis com blog $row category nicename loc changefreqweekly changefreq url $artquery = select p post name date format p post date %y %m %d as createdon from wp posts as p wp categories as cat wp post2cat as pc where p id = pc post id and pc category id = $row cat id group by p id order by p id desc $artresult = mysql query $artquery while $artrow = mysql fetch array $artresult mysql assoc echo url loc trevor davis com blog $row category nicename $artrow post name php loc lastmod $artrow createdon lastmod changefreqweekly changefreq url echo urlset modifying the htaccess file we also want to rewrite the url for this file so that it is available at trevor davis com sitemap xml open up your htaccess file or create one if you dont have one then add the following rewriteengine on rewriterule sitemap xml googlesitemap php upload this file along with the googlesitemap php script to your site root and you are set you can also add the rest of your sites file structure to the sitemap as well you can see how i did this in my google sitemap sitemaps protocal you can read more about the sitemaps protocal to see what other attributes you can apply to each url entry by the way let me know if you can think of any way to improve this 