Yoast’s SEO WordPress plugin for sitemaps without htaccess
Recently, for a client, I started using Yoast’s SEO for WordPress for their blog. Everything was running nicely until we hit a snag with the .htaccess redirect for the sitemap. The client’s website, uses lighttpd, and therefore it doesn’t have all the .htaccess functionality out of the box. With Yoast’s SEO plugin your file will appear at /sitemap.xml [see mine here], which is called via htaccess. Instead of hacking the server to get the XML sitemaps working, I decided to link to the non-rewritten sitemap URL. After searching on the net and not finding any answers, I decided to delve into the code, and below is my findings.
Linking directly to the individual sitemaps
Poking into the code I’ve found out that the links appear as
- Page www.youblog.com/index.php?sitemap=page&sitemap_n=1
- Posts www.youblog.com/index.php?sitemap=post&sitemap_n=1
- Category www.youblog.com/index.php?sitemap=category&sitemap_n=1
- Post Tags www.youblog.com/index.php?sitemap=post_tag&sitemap_n=1
These link to the posts, pages and less importantly to the categories and tag pages. In each of these cases you may need to increment the parameter sitemap_n=, if you have more than 1000 posts (you shouldn’t really have more than 1000 categories or post tags). The plugin limits the number of URLs listed to 1000 per individual sitemap, most likely speed.
More details about what the SEO plugin for WordPress does can be seen here on Yoast’s site.