• WordPress 7.1 breaks native XML sitemaps on Nginx reverse proxy + Apache

    Environment

    • WordPress 7.1: affected
    • WordPress 7.0.4: works correctly
    • Theme: Twenty Twenty-Five
    • Editor: Gutenberg / WordPress block editor
    • Plugins: none
    • Web server: Nginx as a reverse proxy in front of Apache
    • .htaccess: default WordPress rules
    • Native WordPress XML sitemaps enabled
    • No SEO plugin or sitemap plugin is installed

    Description

    I have a WordPress site built entirely with the default Twenty Twenty-Five theme and Gutenberg. There are no plugins installed at all.

    The site was running WordPress 7.0.4 and everything worked correctly, including the native WordPress XML sitemap.

    After upgrading the exact same site to WordPress 7.1, the native XML sitemap URLs started returning HTTP 404 errors.

    The problem affects the sitemap index as well as the individual sitemap.

    For example:

    /wp-sitemap.xml

    and:

    /wp-sitemap-posts-page-1.xml

    both returned HTTP 404 after upgrading to WordPress 7.1.

    The site uses Nginx as a reverse proxy in front of Apache. The Apache .htaccess contains the standard WordPress rewrite rules and has not been customized.

    Reproduction:

    With WordPress 7.1 installed, I tested the sitemap directly from PowerShell using curl.

    For example:

    curl.exe -v "https://example.com/wp-sitemap.xml" -o wp-sitemap-test.xml

    The server returned:

    HTTP/1.1 404 Not Found

    with:

    Server: nginx

    I also tested:

    curl.exe -v "https://example.com/wp-sitemap-posts-page-1.xml" -o pages-sitemap-test.xml

    which also returned:

    HTTP/1.1 404 Not Found

    I additionally tested the sitemap query directly:

    curl.exe -v "https://example.com/?sitemap=posts&sitemap-subtype=page&paged=1" -o query-sitemap-test.xml

    This also returned:

    HTTP/1.1 404 Not Found

    The same behavior was reproducible repeatedly; it was not an intermittent request failure.

    Control test
    I then rolled WordPress back from 7.1 to WordPress 7.0.4 on the same site.

    No other changes were made.

    Immediately after reverting to WordPress 7.0.4, the native sitemap started working again.

    The following URLs worked normally again:

    /wp-sitemap.xml

    /wp-sitemap-posts-page-1.xml

    The site and its native sitemap functionality were therefore working correctly on 7.0.4, and the problem appeared immediately after upgrading to 7.1.

    I also tested different default WordPress themes, including Twenty Twenty-Four and Twenty Twenty-Five. The issue was not resolved by changing themes.

    There are no plugins involved, so there is no third-party sitemap, SEO, caching, or security plugin that could be causing the problem.

    Additional information
    The WordPress-generated sitemap contains the expected child sitemap, and before the rollback Google Search Console reported:

    Couldn’t fetch

    for the sitemap.

    When submitting the sitemap index, Google was able to discover the three pages contained in the page sitemap, but ultimately reported that the sitemap could not be fetched.

    After rolling back to WordPress 7.0.4, the sitemap immediately became accessible again.

    The standard .htaccess is:

    # BEGIN WordPress
    # The directives (lines) between "BEGIN WordPress" and "END WordPress" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    

    No custom sitemap code, SEO plugin, caching plugin, security plugin, or other plugin is installed.

    Expected behavior
    The native WordPress sitemap URLs should be accessible and return the generated XML sitemap, as they do on WordPress 7.0.4.

    Actual behavior
    On WordPress 7.1, the native sitemap URLs return HTTP 404.

    Regression

    The issue appears to be a regression introduced between WordPress 7.0.4 and WordPress 7.1.

    The same site, same server environment, same theme, same .htaccess, and no plugins works correctly on 7.0.4 and fails on 7.1.

    I am reporting this because the problem affects the built-in WordPress sitemap functionality and can prevent search engines from fetching the native sitemap.

    • This topic was modified 1 month, 2 weeks ago by mrkenobi.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator threadi

    (@threadi)

    Interesting. I can’t reproduce this in any of my projects, even though I also use nginx the way you describe. However, there already seems to be a bug report in Core Trac that describes this in more detail: https://core.trac.wordpress.org/ticket/65936 – you’ve apparently opened a duplicate report on this as well. I’d recommend following this one to give it higher priority.

    Thread Starter mrkenobi

    (@mrkenobi)

    I suspect this regression may go largely unnoticed because most WordPress sites don’t actually use WordPress’s native XML sitemaps. A huge number of sites use Yoast SEO, Rank Math, AIOSEO, The SEO Framework, or another SEO plugin that provides its own sitemap functionality.

    As a result, even if WordPress 7.1 breaks the native /wp-sitemap.xml endpoint in certain Nginx reverse proxy + Apache configurations, the vast majority of site owners may never notice it. Their SEO plugin continues serving its own sitemap normally, so everything appears fine.

    This could explain why the issue is difficult to reproduce and why there may be relatively few reports despite the potential impact on the built-in WordPress sitemap functionality.

Viewing 2 replies - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.