WordPress : How to fix Google XML Sitemap

投稿日:07/23/2014 更新日:

Here is what I did to solve 404 problem on Xml-sitemap (version 4 onward) caused by the dynamic sitemap creation.

JUST PASTE THE CODE AS IS ON .htaccess

When you look at the setting of Xml-sitemap closely, it introduces you to add the following code to .htaccess if you have your root directly located on sub-directory. (Link)

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^sitemap(-+([a-zA-Z0-9_-]+))?\.xml(\.gz)?$ /your-blogdir/sitemap$1.xml$2 [L]
</IfModule>

The instruction guides to rename "your-blogdir" part of the code to your blog's sub-directory name.

However, don't do this if renaming didn't fix your problem.

Just leave the code as is and copy & paste it to your .htaccess.

And surprise, the dynamic sitemap creation starts working ! (at least for me)

By the way, I didn't do anything on "Override the base URL of the sitemap" setting.I left it blank.

Support by tweeting or liking on Facebook if this article helped you.

Thanks!

スポンサードリンク

Copyright© ガンサバイバーのデジタル日誌 , 2018 All Rights Reserved.