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
*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:
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
- 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.
- 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).
- See if some other plugin you are using has a sitemap, JetPack, for example.
- Just in case see ‘Dashboard » Tools » SiteHealth’ if there some issues.
Let us know if this resolves your issue.