Posted by & filed under General, Web Development.

WordPress Sitemaps

I recently received an email from Google Webmaster Tools stating that it couldn’t access some of the content I had submitted in my sitemaps. When I loaded up the sitemap that was causing the issue, I found a 404 page greeting me. I recently moved my blog from a subdirectory up to the main directory and I figured that this was probably the reason behind this 404. The For WordPress blogs I’ve always the Google XML Sitemaps plugin to handle the generation of sitemaps and submission of them to the various search engines. I figured that the easiest thing to do would be to delete the current sitemaps and regenerate them. I went searching through the directory containing this site but could not find any sitemaps anywhere. Strange right? A quick Google search also showed other people having this issue but no response form the author on what was going on. The sitemaps were clearly being generated, as I could access some of them. Deleting the plugin removed all those sitemaps from being access all together. At this point I sort of lost faith in the Google XML Sitemaps plugin and decided to look elsewhere.

Step in Yoast SEO

The Yoast SEO sitemaps feature is a little less customisable than Google XML Sitemaps, but it hasn’t created me any 404 pages. Which is the ultimate goal here. I still can’t seem to find where my sitemaps are actually stored on my server. Performing a regex search yields no results. Also, due to my blog not being in the root directory I’ve had to edit my .htaccess file to get the plugin to actually generate the sitemaps, which is pretty lame if you ask me. If you’re having the same problem you need to add the following before this line “# BEGIN WordPress“;

# WordPress SEO - XML Sitemap Rewrite Fix
 RewriteEngine On
 RewriteBase /
 RewriteRule ^sitemap_index.xml$ /index.php?sitemap=1 [L]
 RewriteRule ^locations.kml$ /index.php?sitemap=wpseo_local_kml [L]
 RewriteRule ^geo_sitemap.xml$ /index.php?sitemap=geo [L]
 RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 [L]
 RewriteRule ^([a-z]+)?-?sitemap.xsl$ /index.php?xsl=$1 [L]
 # END WordPress SEO - XML Sitemap Rewrite Fix<br>

 

 

Leave a Reply

You must be logged in to post a comment.