Back to Top

Better WordPress Google XML Sitemaps

Better WordPress Google XML Sitemaps

The first WordPress XML Sitemap plugin that comes with comprehensive support for Sitemapindex and Multi-site. Extend functionality via flexible modules, not just hooks!

Q1: I got white pages and/or ‘Content Encoding Error’ error?

1. PHP error messages from other plugins or from this plugin itself can cause this issue, especially when you have WP_DEBUG set to true (try commenting out this line in your wp-config.php file: define(WP_DEBUG, true);). Refer to Question #3 to know how to trace the actual errors.

2. BWP GXS runs out of memory or reaches maximum execution time. This often happens when you try to build large sitemaps. I’ve tried to optimize this plugin a lot since the first version, but if you are using a lot of memory eating plugins on your website, it is very hard for BWP GXS to build huge sitemaps (containing tens of thousands of items). Anyway, to resolve this issue, try decreasing the three limit options in the Generator tab: max number of items per sitemap (first option), max number of items per split sitemap (first option in Sitemap Index Options) and max items to get in one SQL query (second option in Module Options). You might try the following presets (in the same order as above):

- 1000, 1000, 100 (for sites with low memory limit like 32MB)
- 5000, 5000, 500 (for sites with lots of posts, tags, categories, etc.)
- 5000, 5000, 2500 (if you have problem with max execution time)

Also, you can try the tips mentioned in this post of mine.

3. A caching plugin is interfering. Tell that caching plugin to ignore .xml file. For example, if you use WP Super Cache, on the Advanced Tab, scroll to the ‘Accepted Filenames & Rejected URIs’ section, and then in the first textarea, type in \.xml. Now save the changes and flush the all caches. See if that works for you.

Q2: I’ve tried the tips mentioned in Question #1, but still got white pages / plain text sitemaps?

It’s very likely that you’re enabling this option: ‘Clean unexpected output before sitemap generation’, try disabling it and your sitemaps will show up as expected.

Q3: I got the error ‘Content Encoding Error’, what should I do?

If you are enabling this plugin’s debug mode and/or WP_DEBUG, this error is very normal because the module you use might print errors on pages, thus corrupting your xml sitemaps. To view the actual errors without being greeted with the ‘Content Encoding Error’, please follow these steps:

1. Enable this plugin’s debug mode if you haven’t done so.
2. Open the file class-bwp-simple-gxs.php inside bwp-google-xml-sitemaps/includes/ and look for this function: output_sitemap().
3. Place an exit; right after the opening bracket, like so:

  1. function output_sitemap()
  2. {
  3.     exit;
function output_sitemap()
{
	exit;

4. Refresh the sitemaps with problems.
5. Kindly report the errors you see by commenting or through the contact form. Thanks!

Note that, however, some error messages will never show up. In such case, you might want to locate the error_log file within your WordPress installation’s root directory and read its contents for the error messages.

Q4: I got an ‘Error loading stylesheet’ error, what should I do?

As of version 1.1.0 it is almost impossible for such error to show up, but if you set the site url and the home url differently (one with www and one isn’t), you will see this error. Just choose to disable stylesheet in Generator tab or change your site / home URL settings.

Q5: When I visit any sitemap, a plain (no theme) 404 error page appears / I got an HTTP parse error when I submit sitemap to Google Webmaster Tools, what should I do?

Please first see the answer to the first question, if it didn’t work, and you are using a cache plugin such as W3 Total Cache, it is possible that such plugin wrongly assigns HTTP status headers to my sitemaps.

For example, in W3 Total Cache 0.9.2.2 or possibly older, go to Performance → Browser Cache, and then go to ’404 error exception list’ in the ‘General’ option block, and find this line:

  1. sitemap(_index|[0-9]+)?\.xml(\.gz)?
sitemap(_index|[0-9]+)?\.xml(\.gz)?

OR this line:

  1. sitemap\.xml(\.gz)?
sitemap\.xml(\.gz)?

and change it to:

  1. (sitemapindex|[a-z0-9_-]+)\.xml
(sitemapindex|[a-z0-9_-]+)\.xml

Save the changes and then tell W3TC to auto-install the rewrite rules to your .htaccess file.

BWP GXS’s sitemaps will now have correct HTTP status headers.

Q6: When I visit http://example.com/sitemapindex.xml, I see a 404 error page created by WordPress. What should I do?

This might be caused by unflushed rewrite rules, which should have been flushed when you activate this plugin. You can try flushing them manually by visiting Settings → Permalinks and then clicking Save Changes.

Q7: I choose not to display certain sitemaps but the sitemapindex still displays the them?

What you see is actually a cached version of the sitemapindex. You can wait for it to be refreshed automatically or simply choose to ‘Flush the Cache’.

Q8: BWP GXS tells me that ‘Requested module not found or not allowed’, what should I do?

This depends on specific situations and your current settings. Basically this means that the module you’re trying to access has not been registered with BWP GXS or that module has been disabled but the cached sitemapindex still displays it  (which is related to the question above). For a list of default modules (or sitemaps), please read this section.

Q9: Is there anyway to rename sitemapindex.xml to sitemap.xml?

You don’t have to. A visit to http://example.com/sitemap.xml will show you the same sitemapindex. This is done to make BWP GXS more compatible with blogs that have lots of real robots.txt. Please note that you must remove any real sitemap.xml file in your website’s root for this feature to work.

Q10: The custom sitemapindex I create seems to be nested inside the default sitemapindex, is that a bug or something?

That’s the default behaviour of this plugin and I plan to improve it in future versions. Don’t worry, though, you might see a red X next to your sitemapindex’s name in Google’s Webmaster Tools but that’s only because you haven’t submitted your custom sitemapindex. If you submit it separately, the error will go away :).

(other questions that might benefit others will be posted here…)

Print Article Watch Log