The MU forums have moved to WordPress.org

1 2 3 4

Google Sitemap (120 posts)

  1. stutley
    Member
    Posted 17 years ago #

    I've installed the Google Sitemap-plugin and it works like a charm.

    However, when setting up a Google Sitemap-account, users must verify the location of the sitemap by uploading an HTML-file to their blog.

    How do I let my users do that and where will the file go?

  2. drmike
    Member
    Posted 17 years ago #

    Tell us how you got it to work since we can't get past the issue with getting the sitemap.xml file to please correctly and I'll help you with the verify file issue. :)

  3. stutley
    Member
    Posted 17 years ago #

    Sure thing :)

    I'll post it tomorrow - I'm a bit tired right now.

    If you know PHP, it's not that difficult - I think I only made changes to 2 or 3 functions in the sitemap.php-file :)

  4. samchng
    Member
    Posted 17 years ago #

    Cool! Now we have sitemaps! sshkala you see this?

  5. drmike
    Member
    Posted 17 years ago #

    Always had sitemaps. They just weren't in the correct place.

    Working on the verify issue. Is the filename for the verify procedure always named somehting like google*.html?

  6. stutley
    Member
    Posted 17 years ago #

    > Is the filename for the verify procedure always named somehting like google*.html?

    I don't know, but here's how I got sitemap.xml to be created the right place. I'm really bad at documenting my own changes, so I've uploaded my original sitemap.php along with the sitemap.php that works with MU.

    Please note, that some of the changes probably overwrites some security settings, but let me know if you have trouble. I'm not an expert on this, so please don't get mad if I can't help you :D

    Basically, I only made changes to two functions:

    sm_getHomePath() on line 369
    ..and..
    sm_getXmlUrl() on line 402

    I think the problem with sm_getHomePath is that it uses the absolute path which is fine if it hadn't been for MU's structure with mod_rewrites and all.

    So I hardcoded the correct paths into the function (line 390 to 395).

    This problem also resulted in sm_getXmlUrl trying to place the file in a wrong directory. I want my users' sitemaps to be available in their /files-directory. E.g. someblog.blog.com/files/sitemap.xml. So again, I did some hardcoding into the function. Please see lines 415 to 419.

    Hope it helps - it works fine for me anyway :)

    Links:
    Original sitemap.php: http://www.studinski.dk/sitemap.txt
    WPMU sitemap.php: http://www.studinski.dk/sitemap-wpmu.txt

    Notes:
    I use ITDamager's htaccess.
    Also, the blogs.dir-directory have been CHMOD'ed recursive so all new blog-directories are writable by the sitemap-script per default.

    Enjoy ;)

  7. samchng
    Member
    Posted 17 years ago #

    "the blogs.dir-directory have been CHMOD'ed recursive"

    Can you explain that in more detail, or direct me to information on that? Thanks.

  8. stutley
    Member
    Posted 17 years ago #

    It just means that child-directories will be assigned the same CHMOD as the parent directory. In this case, all child-directories of blogs.dir will automatically get the same CHMOD as the blogs.dir-directory.

    I did it through my control panel, but I'm not sure if it's even an issue :)

  9. samchng
    Member
    Posted 17 years ago #

    Oh, all right. Don't think its n issue. Thanks stutley.

  10. drmike
    Member
    Posted 17 years ago #

    That's not happening with me. Blog.dir is set to 777 while newly created subdirectories are being set to 755. It's a pain. Maybe an issue with CPanel though. (Wouldn't surprise me) The sitemap.xml files are not writable either.

    edit: I just noticed that mywebhost changed ownership of the subdirectories and files to my account from nobody. Looking into that now.

    Anyway, I was just going to try doing a htaccess redirect on the google verify file from google*.html to a single set file. I hadn't tried it yet over here but I don't see if it would be an issue.

  11. stutley
    Member
    Posted 17 years ago #

    If that's the case, it doesn't seem that the chmod-problem is related to WPMU or the sitemap-plugin. Have you tried switching safe mode off just to check if that's the problem?

    I'm with servage.net who has developed their own control panel and I don't know anything about CPanel.

    It would be awesome if you could do an htaccess-thingy to redirect to a single google-verification file. I'm waiting ;)

  12. drmike
    Member
    Posted 17 years ago #

    It's not my box as for certain legal and IRS reasons, my own sites I host away from my hosting servers. *grumble*

    I can't stand CPanel as well. We use Direct Admin and I would normally have root access but in this case I don't.

    I really need to just lease myself my own box but I don't have any available.

  13. drmike
    Member
    Posted 17 years ago #

    Um...

    $res = '/absolute/path//wp-inst/wp-content/blogs.dir/' . $blog_id . '/files/';
    } else {
    $res = '/absolute/path/wp-inst/';

    I think maybe that should be edited?

    edit: Yeah, that fixed it. Why though drop it into files? Why not just the normal subdirectory for the blog? I'm kind of curious to your reasoning on that on.

    Now that it works, I'll see about the verify file.

  14. samchng
    Member
    Posted 17 years ago #

    That line is from which file? You found a buggy drmike?? :)

  15. stutley
    Member
    Posted 17 years ago #

    Uhm, yeah, maybe I forgot to mention that those lines should be edited :)

    There's no specific reason as to why I drop the file in the files-directory, but feel free to change ;)

  16. drmike
    Member
    Posted 17 years ago #

    *cough* IIRC, there was one after that as well. I can't edit from here though. (Lousy locked down terminals....)

    I've really been trying to stay away from editing files around here as it appears that this crowd doesn't like the idea. (no offense intended) I have no problem with editing files though.

  17. drmike
    Member
    Posted 17 years ago #

    There's no specific reason as to why I drop the file in the files-directory, but feel free to change

    Unfortunely there appears to be an issue as Google will not take anything outside of that files subdirectory.

    For example:

    Sitemap location: http: //tttt.daria.be/files/sitemap.xml

    Error: URL not allowed (Line 5) with URL http: //tttt.daria.be/

    Detail: This url is not allowed for a Sitemap at this location.

    Google puts this in their help file as well.

    Dropping it into the blog subdirectory above the files one gives a not found error. I'm assuming that we need yet another htaccess rule here.

    Ain't this fun? ;)

  18. stutley
    Member
    Posted 17 years ago #

    Hehe .. Actually, I hadn't noticed that at all. I use ITDamager's htaccess and that might me the reason that sitemap.xml is available from e.g. phillip.blogbar.dk/sitemap.xml even though it's placed in the files-subdirectory. I can't tell since I don't know how to do mod_rewrites.

  19. drmike
    Member
    Posted 17 years ago #

    Yeah, but isn't that the main blog for your MU install?

    I'm not able to get the other blogs to get their sitemaps to come up. Makes them fine. Just can't get rid of that files bit from the url. Gives me a 404 within the blog's theme.

    :(

  20. drmike
    Member
    Posted 17 years ago #

    OK, I think I've gotten this to work. I had to place the following line in the htaccess file to make it work though:

    RewriteRule ^sitemap.xml /wp-inst/wp-content/blogs.php?file=sitemap.xml [L]

    I also had to add in 'xml' into the allowed upload file types option within Dashboard -> SiteAdmin -> Options. Without doing this, it looked horrible when brought up in a browser. Not sure if Google would take it but I know I would get support requests on it.

    Now, off to do the verify file. :)

    Thanks all,
    -drmike

  21. stutley
    Member
    Posted 17 years ago #

    Sorry, I haven't answered - was out of town, but I see you figured it out. Good work ;)

  22. drmike
    Member
    Posted 17 years ago #

    Still waiting for Google to pick it up though. I submitted it but it appears we missed each other while I was working on the htaccess file so it got a 404. Still waiting for a second try to make sure this works.

    Ain't computers fun? ;)

  23. stutley
    Member
    Posted 17 years ago #

    Yeah .. But in my experience Google can take forever to pick up the sitemap. First time I did it (outside WordPress) it took three weeks :S That is rare, though.

  24. drmike
    Member
    Posted 17 years ago #

    Greets:

    It appears that this htaccess line no longer works.

    Did anyone get one that did work?

    Thanks,
    -drmike

  25. drmike
    Member
    Posted 17 years ago #

    And now it seems to work. Ain't computers fun? ;D

  26. drmike
    Member
    Posted 17 years ago #

    I just had a question. Did the 2.7.1 version display the log or was just that the newer version of the plugin? Could have sworn that the older version did it as well.

    thanks,
    -drmike

  27. Ovidiu
    Member
    Posted 17 years ago #

    did anyone try the new version 3.0b ?
    Is that one working with WPMU too?

    and one more question about the location of the sitemaps: you all seem to use b/wp-content/blogs.dir/1/files directory easily enough but I notices that the blog_id directories are not automatically generated, only when there are files uploaded, so if someone tries to write a sitemap before he uploads any files I get:

    Could not write into /var/www/web5/web/wp-content/blogs.dir/2/files/sitemap.xml

    Could not write into /var/www/web5/web/wp-content/blogs.dir/2/files/sitemap.xml.gz

    because obviously the script only tries to write there, so if the directory 2 does not exist so far because that blog did not upload any files so far ...

    any quick solutions to this?

  28. Ovidiu
    Member
    Posted 17 years ago #

    @drmike:

    I tried your advice:

    RewriteRule ^sitemap.xml /wp-inst/wp-content/blogs.php?file=sitemap.xml [L]

    I also had to add in 'xml' into the allowed upload file types option within Dashboard -> SiteAdmin -> Options.

    but I had to do some more to get it working. I did not have to add xml to allowed filetypes as it was already in the list but I had a look at

    /var/www/web5/web/wp-content/blogs.php

    and there were a lot of filetypes lsited but no xml, so I added this line:

    'xml' => 'txt/xml'

    at the end of the fieltype list there and now it works like a charm :-) my sitemap file is located here: http://sibiu.zice.ro/files/sitemap.xml but google accepted and picked up this url: http://sibiu.zice.ro/sitemap.xml and it works.

    Still my question from my last post is still open: how can I get the directories for each blog to be generated at blog-creation-time? (aka wp-content/blogs.dir/$blog_id/

  29. Ovidiu
    Member
    Posted 17 years ago #

    also if you want to make your sitemap.xml file human readable, go download the needed files according to this howto:
    http://www.baccoubonneville.com/blogs/index.php/webdesign/2005/08/20/google-sitemaps-stylesheets

    and add the third line from this code into your sitemap.php:


    //Content of the XML file
    $s='<?xml version="1.0" encoding="UTF-8"' . '?' . '>'. "n";
    $s='<?xml-stylesheet type="text/xsl" href="http://yourdomain.com/gss.xsl"' . '?' . '>'. "n";

    P.S. please do not forget my question two posts ago about the automatic generation of the blog ID dirs.

    P.P.S. I see that when I click the button to manually create a new sitemap that google gets pinged with the full url to the sitemap which is not good I guess because google won't accept sitemaps which are not in the root, in my example google gets pinged with: http://sibiu.zice.ro/files/sitemap.xml which is indeed the location of my sitemap but when pinging google the /files part should be cut out - can someone figure out the code to do that?

  30. suleiman
    Member
    Posted 17 years ago #

    This is working in my sub-blogs but not on the main blog. For some reason I get an error that the file doesn't exist. This is the relevant portion of my sitemap.php file:

    if(get_bloginfo('siteurl') != 'http://hadithuna.com') {
    global $blog_id;
    $res = '/home/suleiman/public_html/wp-content/blogs.dir/' . $blog_id . '/files/';
    } else {
    $res = '/home/suleiman/public_html/wp-content/';
    }
    return $res;

    And I use the htaccess code from above.

1 2 3 4

About this Topic