49 responses to “Google XML Sitemaps and WordPress Multisite”

  1. Abhinav

    Hello and thanks for this wonderful tutorial. Can you please tell me how to use this plugin with multisite @ directory. I’m not using it @ sub-domain. hence, the above re-write rules are not working.

    1. lonelicloud

      HERE is the rewrite_rule for directory installation.
      http://cnzhx.net/blog/articles/google-xml-sitemaps-and-wordpress-multisite/
      You could skip the Chinese chars and look for the rules, or like this:

      RewriteRule ^([_0-9a-zA-Z-]+)/sitemap\.xml$ sitemap-$1.xml [L]
      RewriteRule ^([_0-9a-zA-Z-]+)/sitemap\.xml\.gz$ sitemap-$1.xml.gz [L]
      

      where $1 is the directories of sites on your network.
      like:

      sitemap-blog1.xml
      sitemap-blog1.xml.gz
      
      1. lonelicloud

        It’s odd! But I can click the link and go to the right page. AND, this site is mainly in Chinese but it’s hosted in U.S. with a free host plan. Maybe FREE is the reason.
        Anyway, that’s not important because the rules is here and anyone can see it.

  2. Alan

    This worked perfectly. Thank you, you have saved me so much time and I was getting a headache trying to find a plugin that could do this.

    I hope Arne can get his plugin updated soon, but for now this is just what I needed.

    Thanks Again

  3. JAG

    Jan,

    Thank you for posting this!

    Had to play around with the subdomain url because I’m on cloud servers but aside from that your instructions are excellent and the plugin works flawlessly.

    Cheers!

    JAG

  4. Google XML Sitemaps与WordPress 多站点(Multisite) « 不存在的空间

    [...] 我就碰到了这样的事情,好在从国外某个网站上看到了临时的解决办法,经过测试,该方法也适用于以子目录(Sub-Directory)形式安装的多站点,当然,根据原文作者的叙述我们知道,它是适用于以子域名(Sub-Domain)方式启用的多站点的。 [...]

  5. WordPress 3.0 multisite: cómo instalarlo (I)

    [...] a la incompatibilidad de plugins, por ejemplo el famoso Google (XML) Sitemaps Generator (para generar archivos con el sitemap) no trabaja con WP multisite. Pero Jan Dembowski nos explica [...]

  6. WordPress 3.0 multisite: cómo instalarlo (I) « GermanJose

    [...] posibles dolores de cabeza. Respecto a la incompatibilidad de plugins, por ejemplo el famoso Google (XML) Sitemaps Generator (para generar archivos con el sitemap) no trabaja con WP multisite. Pero Jan Dembowski nos explica [...]

  7. Soluzione compatibilità di Google XML Sitemap con Wordpress Multi sito | Solo Wordpress

    [...] che sarà aggiornato il plug-in, purtroppo bisognerà ripetere la procedura già spiegata. Via: Mostly Harmless Articoli Correlati:WordPress 3.0 disponibileImpostare data in italiano in WordPressCondividi var [...]

  8. Max

    Jan, thanks a lot! It’s realy works!
    I made it on my web(multi)site, and it works correctly. Any php errors or other bugs.

    Thanks again!

  9. Google XML Sitemaps pour Wordpress 3, Wp-Mu et BuddyPress | Blog SEO & Référencement, himselfprod

    [...] fouillant le web j’ai trouvé la solution suivante sur le blog de Jan Dembowski, solution compatible avec la version 3.2.4 de Google XML [...]

  10. Google XML Sitemaps+wordpress3.0 | エゾスタイル

    [...] Google XML Sitemaps and WordPress Multisite [...]

  11. Oliver

    There is a more elegant way for networks. You can activate the plugin for network and edit the function GetXmlPath in sitemap-core.php

    	function GetXmlPath($forceAuto=false) {
    		if(!$forceAuto && $this->GetOption("b_location_mode")=="manual") {
    			$xml_path = $this->GetOption("b_filename_manual");
    		} else {
    			$xml_path = $this->GetHomePath()  . $this->GetOption("b_filename");
    		}
    		if((defined('WP_ALLOW_MULTISITE') && WP_ALLOW_MULTISITE) || (function_exists('is_multisite') && is_multisite())) {
    			return str_replace('sitemap.xml', 'sitemaps/sitemap.'.$_SERVER['HTTP_HOST'].'.xml', $xml_path);
    		}
    		return $xml_path;
    	}
    

    Create a directory in your root path called “sitemaps” and chmod it to 777. Add this to your .htaccess:

    RewriteRule ^sitemap.xml sitemaps/sitemap.%{SERVER_NAME}.xml [L]
    RewriteRule ^sitemap.xml.gz sitemaps/sitemap.%{SERVER_NAME}.xml.gz [L]
    

    Thats it! The sitemaps will be generated in the sitemap directory.

    1. Ivan

      Error loading stylesheet: An unknown error has occurred (805303f4)http://www.mysite.net/wp-content/plugins/google-sitemap-generator/sitemap.xsl

      i did all like you described and still getting errors while creating sitemap for my subdomains?!?!

      1. Ivan

        i can load sitemap.xsl just fine, i can even access to rootdomain sitemap the only problem is when i try to access to subdomain’s sitemap

    2. anjan

      Hi Oliver,
      Have you tried those changes yourself.When I activate plugin for network the error message pops up as said in this article.
      “Google XML Sitemaps is not multisite compatible.
      Unfortunately the Google XML Sitemaps plugin was not tested with the multisite feature of WordPress 3.0 yet. The plugin will not be active until you disable the multisite mode. Otherwise go to active plugins and deactivate the Google XML Sitemaps plugin to make this message disappear.”

      So it seems plugin can’t me made active using network activate mode.

  12. Google XML Sitemaps Plugin unter Wordpress 3 Multisite nutzen - wp-contentpluginsgoogle-sitemap-generator , sitemapphp , htaccess, Sitemap - Servervoice der Technik Blog

    [...] diesem Blog habe ich eine Anleitung gefunden wie man das Google XML Sitemaps Plugin anpassen muss das dieses [...]

  13. マルチサイトでGoogle (XML) Sitemaps Generator for WordPressを使う » サイトのブログ

    [...] まず、参考にさせていただいた「WP3.0ネットワークでGoogle Sitemapを作成する」は「Google XML Sitemaps and WordPress Multisite」を参考にしたものということなので、そちらも合わせて読まれることをお勧めします。 以下、参考にさせていただいた「WP3.0ネットワークでGoogle Sitemapを作成する」を基準に、今回少し自分なりに工夫した点について掲げます。 [...]

  14. NTB

    I think that the .htaccess rewrite rule should be more strict

    With your example the url for sitemap.xml.gz is redirected to to sitemap.xml

    I suggest using:

    RewriteRule ^sitemap.xml$ sitemaps/sitemap.%{SERVER_NAME}.xml [L]
    RewriteRule ^sitemap.xml.gz$ sitemaps/sitemap.%{SERVER_NAME}.xml.gz [L]
    
  15. zamzam

    hello,

    my wpmu main domain is nol.im, is it correct setting for subdomain ?

    Absolute or relative path to the sitemap file, including name.
    /home/nol/public_html/jewelry.nol.im/sitemap-jewelry.nol.im.xml

    Complete URL to the sitemap file, including name.
    http://jewelry.nol.im/sitemap-jewelry.nol.im.xml

  16. Google XML Sitemaps plugin on multi-blog by wordpress 3.0 » labs.daruyanagi.net

    [...] 参考: Google XML Sitemaps and WordPress Multisite [...]

  17. Rene Silva

    Thanks for the advice!

  18. guialowcost

    I did all but still have this message: Google XML Sitemaps is not multisite compatible.

  19. Alexandre

    Hello, thks for the great hack.

    After the process, I had both sitemaps, the old and the new one.

    After delete the oldest, I check my robots.txt, as you sugested, but I only have “User-agent: *” and “Disallow:” terms. Should it have too a “new sitemap path”, havent it?

    I made a .htacess hack putting the RewriteRule above de # BEGIN WordPress line. Sorry for may poor php skill :-)

    Thks again.
    Alexandre

  20. Michael

    Jan -

    What do you do if you’ve got the multisite blog installed in the root directory? There is no directory for the main blog so what would you use for the $1 variable?

    1. Michael

      Here’s a follow up question – what if you’re using another sitemap generator for the rest of your site which also leaves a sitemap.xml file in the root directory? It needs to be placed in another subdirectory and that would probably be a prudent measure unless you only run wordpress on your domain.

  21. WordPress 3.0 Multisite – tips&tweaks | WP Tuts

    [...] Unul dintre pluginurile importante care nu funcționa corect cu WordPress Multisite este Google Sitemap XML. Pentru utilizatorii mai avansați – necesită modificarea unui fișier PHP, adăugarea unor reguli noi în .htaccess și configurare avansată a pluginului, găsești un articol explicativ aici. [...]

  22. OJ

    Hi,
    What do you do with the old sitemap you have submitted under Google’s webmaster’s tool? Do you delete it or what?

    Now I have two, the old one and the newly created after making your modifications. Is this going to affect my index or perhaps, my ranking?

    Thanks :)

  23. Wordpress Multisite con sudominios en hosting compartido | Prog man in a prog world

    [...] aunque el autor está trabajando en una versión que lo soporte. Mientras que esto sea así, Ian Dembowski ha creado un workaround fácil y rápido que funciona a las mil maravillas. Estos son los pasos a [...]

  24. Google Sitemap Generator y WordPress 3.0 Multisite

    [...] embargo, en uno de los comentarios del post Google XML Sitemaps and WordPress Multisite, se aporta una alternativa mucho más elegante. A continuación, los pasos a [...]

  25. Google Sitemap Generator y WordPress 3.0 Multisite | Todo bit

    [...] embargo, en uno de los comentarios del post Google XML Sitemaps and WordPress Multisite, se aporta una alternativa mucho más elegante. A continuación, los pasos a [...]

  26. Markus Richert

    Thanks for this great tutorial.

    It’s even more elegant, to create a subdirectory for each set of sitemaps.
    So the RewriteRules would look like:

    RewriteRule ^sitemap.xml.gz sitemaps/%{SERVER_NAME}/sitemap.xml.gz [L]
    RewriteRule ^sitemap.xml sitemaps/%{SERVER_NAME}/sitemap.xml [L]

    As mentioned before in exact this order, gz first, then the one without. Otherwise the first rule catches them all.

    The third step is spare to edit for each blog, if you replace the following into sitemap-core.php in function GetXmlPath, line 1386:

    			return $this->GetHomePath()  . $this->GetOption("b_filename");
    

    with this:

    			$dir = $this->GetHomePath() . 'sitemaps/'.trailingslashit($_SERVER['HTTP_HOST']);
    			if(!file_exists($dir)) {
    				mkdir($dir);
    				clearstatcache();
    				sleep(1);
    			}
    			return $dir . $this->GetOption("b_filename");
    

    This will automatically create a subdir for each blog containing the sitemaps therefor.

    Step 4 is also spare, if you don’t use a physical robots.txt, but the WordPress virtual one instead. You only need to check “Add the sitemap to the virtual robots.txt” in the XML Sitemap options and are done with your hand work.

Leave a Reply