Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter iroberto83

    (@iroberto83)

    Solved adding these 3 rewrite rules on server block:

    rewrite ^/sitemapindex\.xml$ /index.php?sitemap=1 last;
    rewrite ^/([^/]+?)_part([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
    rewrite ^/([^/]+?)\.xml$ /index.php?sitemap=$1 last;

    The first it’s for the index, the second for the paged sitemaps, the third for the all other sitemap pages.

    Plugin Author Khang Minh

    (@oddoneout)

    Shouldn’t the first rule look like this?

    rewrite ^/sitemapindex\.xml$ /index.php?sitemap=$1 last;

    The second and the third rules are not for BWP GXS I believe.

    Thread Starter iroberto83

    (@iroberto83)

    With only the first rule doesn’t work the subpages.

    I have the same issue – what is the solution here – as it is marked as [resolved] then?

    Thread Starter iroberto83

    (@iroberto83)

    Hi StudioZ2, please paste the nginx rules you’re using for sitemap.

    Hi iroberto83!

    I have used Yoast’s SEO sitemap solution with those:

    “rewrite ^/sitemap_index\.xml$ /index.php?sitemap=1 last;
    rewrite ^/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;”

    But lately changed to Better WordPress Google XML Sitemaps for better control and is showing “404 Not Found Nginx”.

    My server admin seems to not know the solution – asked me to get correct rules from the dev of the plugin.

    It would be great if you paste nginx rules here…through that I can guide you better .

    Any ideas?

    Thread Starter iroberto83

    (@iroberto83)

    Hi StudioZ2, I suggest you to disable the Yoast Seo Sitemap using instead BWP Sitemap. The Yoast rules are for his own sitemaps,
    for BWP you’ve to use:

    rewrite ^/sitemapindex\.xml$ /index.php?sitemap=1 last;
    or
    rewrite ^/sitemapindex\.xml$ /index.php?sitemap=$1 last;
    as suggested from the author,

    and for the submaps i suggest to add:
    rewrite ^/([^/]+?)_part([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
    rewrite ^/([^/]+?)\.xml$ /index.php?sitemap=$1 last;

    But for an optimal work you can try once only with:
    rewrite ^/sitemapindex\.xml$ /index.php?sitemap=1 last;
    or
    rewrite ^/sitemapindex\.xml$ /index.php?sitemap=$1 last;
    and if you have problems with the submaps proceed adding the other two rules.

    Obviously restart or reload nginx service and flush the wp rewrite rules before all.

    Let me know how does it works đŸ™‚

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘404 Not Found on Nginx’ is closed to new replies.