WordPress.org

Ready to get started?Download WordPress

Forums

Sitemap with nginx: Getting 404 AND the content (4 posts)

  1. Joe
    Member
    Posted 2 years ago #

    Ok.. I followed the sitemap 404 threads.. And I fixed most. But now I have something weird.

    I used the nginx rewrite rules:

    # For WordPress SEO plugin
            rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
            rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
            rewrite ^/news_sitemap\.xml$ /index.php?sitemap=wpseo_news last;

    And when I browse to my site /sitemap_index.xml my browser shows the content. I see in my logs that Googlebot (and I get a 404!)

    Did a manual GET and indeed. It returns the content, but the return code is a 404! How can I fix this?

    HTTP/1.1 404 Not Found
    Server: nginx/1.1.19
    Date: Fri, 13 Jul 2012 21:54:04 GMT
    Content-Type: text/xml
    Transfer-Encoding: chunked
    Connection: keep-alive
    X-Powered-By: PHP/5.3.10-1ubuntu3.2
    X-Pingback: http://XXXXXXXXX.com/xmlrpc.php
    Expires: Wed, 11 Jan 1984 05:00:00 GMT
    Last-Modified: Fri, 13 Jul 2012 21:54:04 GMT
    Cache-Control: no-cache, must-revalidate, max-age=0
    Pragma: no-cache
    X-Robots-Tag: noindex, follow
    
    1a1
    <?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="http://XXXXXXXXX.com/wp-content/plugins/wordpress-seo/css/xml-sitemap-xsl.php"?>
    <sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <sitemap>
    <loc>http://XXXXXXXXX.com/page-sitemap.xml</loc>
    <lastmod>2012-07-13T21:47:33+00:00</lastmod>
    </sitemap>
    </sitemapindex>
    <!-- XML Sitemap generated by Yoast WordPress SEO -->
  2. Joe
    Member
    Posted 2 years ago #

    Added information..

    When I directly request the file from /index.php?sitemap=1 it does return a 200 status code. So it's definitely in the way nginx handles the rewrite mentioned above..

    Althoug not a specific plugin question, it is something more will run into.. Does anybody have any idea why the above rewrite (in combination with the nginx wordpress conf located on http://codex.wordpress.org/Nginx has such a side effect?

    I'm not using any plugins, caches, other than this one.. :S

  3. Pothi
    Member
    Posted 2 years ago #

    I use the nginx configuration found in Nginx without the three lines of rewrites you mentioned _for WordPress SEO plugin_. So, have you tried removing those rewrites (and reload or restart Nginx)?

  4. popac
    Member
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Topic