WordPress 5.5 sitemap does not load on Nginx server
-
Hi! The WordPress 5.5 sitemaps return a
404 Not Found
error on Nginx servers.To reproduce:
1. Install WordPress 5.5 on any Nginx server
2. Visit<your_site>/robots.txt
to confirm theSitemap: <your_site>/wp-sitemap.xml
line is present
3. Visit<your_site>/wp-sitemap.xml
and notice it returns a404 Not Found
errorThis is because custom rewrite rules must be specified in your Nginx config. For the popular Google XML Sitemaps plugin, the required rewrite rules are:
rewrite ^/robots\.txt$ "/index.php?robots=1" last; rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.xml$ "/index.php?xml_sitemap=params=$2" last; rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.xml\.gz$ "/index.php?xml_sitemap=params=$2;zip=true" last; rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.html$ "/index.php?xml_sitemap=params=$2;html=true" last; rewrite ^/sitemap(-+([a-zA-Z0-9_-]+))?\.html.gz$ "/index.php?xml_sitemap=params=$2;html=true;zip=true" last;
What are the required rewrite rules to get WordPress 5.5 sitemaps working in Nginx?
Viewing 10 replies - 1 through 10 (of 10 total)
Viewing 10 replies - 1 through 10 (of 10 total)
- The topic ‘WordPress 5.5 sitemap does not load on Nginx server’ is closed to new replies.