WordPress wp-sitemap.xml creating HTTP/501 status code and how to fix it?

I created a Docker image from scratch using Alpine Linux. It works correctly, but whenever I try to submit or view example.com/wp-sitemap.xml, it says HTTP/501 status. How can I fix it?

Did you install simplexml PHP 7 or PHP 8 extension? For Alpine Linux search it:

apk search php | grep -i simplexml

Version may differ but something like needs to be installed on Alpine Linux or Docker image:


Installing php7-simplexml or php8-simplexml to fix WordPress wp-sitemap.xml creating HTTP/501 status code

Is PHP *simplexml installed on your server or image?

apk list --installed | grep simplexml

Then install it if not installed by default:

apk add php7-simplexml
(1/1) Installing php7-simplexml (7.4.22-r0)
OK: 187 MiB in 142 packages

Restart the Nginx/Apache or PHP services as per your web server. I have php-fpm7 for Apache so I do:

/etc/init.d/php-fpm7 restart

For Docker image add the following line in your Docker file:

RUN apk --no-cache add php7-simplexml

Rebuild image again. Now test it:

curl -I example.com/wp-sitemap.xml

Checking for Wordpress config

Also check

  1. See ‘Dashboard » Settings » Reading » Search engine visibility’ if ‘Discourage search engines from indexing this site’ isn’t checked. If the site doesn’t need to be indexed, it doesn’t need a sitemap.
  2. If you have dynamic ‘/robots.txt’ (no physical file on the root directory of your site) see if the link to the map exists. If it’s there try to rebuild permalinks:
    ‘Dashboard » Settings » Permalinks’ by pushing ‘Save Changes’ (there is no need to make any changes).
  3. See if some other plugin you are using has a sitemap, JetPack, for example.
  4. Just in case see ‘Dashboard » Tools » SiteHealth’ if there some issues.

Let us know if this resolves your issue.

Linux sysadmin blog - Linux/Unix Howtos and Tutorials - Linux bash shell scripting wiki