Fixing the 404 Error Using DD-Sitemap Generator & WP-Cache

After reviewing my latest Google Sitemap statistics, I noticed that there was an error being reported. The message stated that the link to my DD-sitemap was broken.

I quickly navigated there and found that everything was fine. The sitemap displayed as usual.

Confused, I checked the headers with Live HTTP Headers and found that my sitemap was sending a 404 error, which doesn’t make sense because the page loaded normally.

After thinking about the issue for a bit, and trying to contain my rage, I realized that the problem started after I installed the WP-Cache plugin. I went to my the plugin options to disable the sitemap from being cached, but that didn’t work.

So, I hacked the wp-config.php file in Wordpress, by adding the snibbet below, and seem to have fixed the issue:

if ($_SERVER['REQUEST_URI'] === '/sitemap/') {
header('HTTP/1.1 200 OK');

Now, a request for my sitemap page will always return a HTTP status of 200 and spiders can stop thinking the link is broken.

I’m not sure if this solution is bulletproof, but it seems to get the job done.

  • Help Me Improve!

  • The only way for my posts to get better is to get your opinion! So help me out, and rate this one! Thanks!
     Votes | Average: 0 out of 5 Votes | Average: 0 out of 5 Votes | Average: 0 out of 5 Votes | Average: 0 out of 5 Votes | Average: 0 out of 5
    No ratings.
    Loading ... Loading ...

Leave a Comment

Creative Commons License

This work is licensed under a
Creative Commons Attribution 2.5 License.
33 queries. 0.367 seconds.