The Google XML Sitemaps plugin for WordPress is amazing. It helps dramatically with your SEO by letting Google and other search engines you’ve updated you WordPress website.
After setting up the plugin with default settings it generates the first sitemap correctly, but I had some issues with Google Webmaster Tools recognizing the XML sitemap without generating errors. When I looked at the indexed URL’s in Webmaster Tools it showed hundreds of pages from my WordPress site (man-log.com) but had a red “X” next to all the URL’s. Specifically the error I got was:
Paths don’t match
We’ve detected that you submitted your Sitemap using a URL path that includes the www prefix (for instance, http://www.example.com/sitemap.xml). However, the URLs listed inside your Sitemap don’t use the www prefix (for instance, http://example.com/myfile.htm)
After some creative Googling I found a solution. Google sees www.website.com and website.com as 2 different websites. Below are the steps I took to fix this problem:
- In your Google Webmaster account, add another website to your account and verify it: the www or non-www version (whichever you don’t already have).
- Submit your sitemap URL to this 2nd version of your website.
- Check your WordPress installation preferences under “Settings > General” and set “WordPress address (URL)” and “Site address (URL)” to your preferred web address – either www or non-www.
- If you have changed your URL in Step 3, deactivate and remove the WordPress XML Sitemaps plugin. Then re-install the plugin.
- Regenerate the sitemap within the plugin settings.
Here’s the error I got when trying to load the URL when I didn’t re-install the plugin after the change:
Error loading stylesheet: An unknown error has occurred (805303f4)
After adding both versions of the website, reinstalling the Google XML Sitemaps plugin, rebuilding the sitemap manually, and many refreshes, everything is working just fine.