{"id":421,"date":"2025-02-10T13:19:53","date_gmt":"2025-02-10T05:19:53","guid":{"rendered":"https:\/\/virtualcardx.com\/?p=421"},"modified":"2026-01-04T13:29:54","modified_gmt":"2026-01-04T05:29:54","slug":"nginx-%e6%9c%8d%e5%8a%a1%e5%99%a8%e6%90%ad%e5%bb%bawordpress%e4%bd%bf%e7%94%a8rank-math-seo%e6%8f%92%e4%bb%b6%e7%94%9f%e6%88%90sitemaps%e9%9c%80%e8%a6%81%e8%bf%9b%e8%a1%8c%e7%9a%84%e9%a2%9d%e5%a4%96","status":"publish","type":"post","link":"https:\/\/virtualcardx.com\/en\/2025\/02\/10\/nginx-\u670d\u52a1\u5668\u642d\u5efawordpress\u4f7f\u7528rank-math-seo\u63d2\u4ef6\u751f\u6210sitemaps\u9700\u8981\u8fdb\u884c\u7684\u989d\u5916\/","title":{"rendered":"Nginx server build WordPress using Rank Math SEO plugin to generate Sitemaps need to do additional settings"},"content":{"rendered":"<p class=\"wp-block-paragraph\">Rank Math creates a sitemap dynamically, which relies on using redirects at the server level. In some cases, you will need to manually add some rewrite rules if your sitemap is not working as expected.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To make sure you need to add these rewrite rules, go to domain.com?sitemap=1.<\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-84b647da\"><img decoding=\"async\" width=\"1091\" height=\"524\" class=\"gb-image gb-image-84b647da lazyload\" data-src=\"https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/Check-Sitemap-generation-in-Rank-Math.png\" alt=\"Check sitemap generation in Rank Math\" title=\"Check-Sitemap-generation-in-Rank-Math\" data-srcset=\"https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/Check-Sitemap-generation-in-Rank-Math.png 1091w, https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/Check-Sitemap-generation-in-Rank-Math-300x144.png 300w, https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/Check-Sitemap-generation-in-Rank-Math-1024x492.png 1024w, https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/Check-Sitemap-generation-in-Rank-Math-768x369.png 768w, https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/Check-Sitemap-generation-in-Rank-Math-600x288.png 600w\" data-sizes=\"(max-width: 1091px) 100vw, 1091px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1091px; --smush-placeholder-aspect-ratio: 1091\/524;\" \/><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">If the sitemap loads successfully, it means that Rank Math SEO was able to generate the sitemap successfully, but was unable to rewrite the sitemap to the sitemap_index.xml page.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Fix sitemap issue with Rank Math SEO on Nginx server<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">If the Nginx server prevents the creation of sitemap files, then Rank Math will also let you know via a notification under sitemap settings. In this case, you need to add the rewrite rule manually.<\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-b496c493\"><img decoding=\"async\" width=\"1015\" height=\"238\" class=\"gb-image gb-image-b496c493 lazyload\" data-src=\"https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/Rank-Math-Sitemap-notice-on-Nginx-server.jpg\" alt=\"Rank math sitemap notifications on Nginx servers\" title=\"Rank-Math-Sitemap-notice-on-Nginx-server\" data-srcset=\"https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/Rank-Math-Sitemap-notice-on-Nginx-server.jpg 1015w, https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/Rank-Math-Sitemap-notice-on-Nginx-server-300x70.jpg 300w, https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/Rank-Math-Sitemap-notice-on-Nginx-server-768x180.jpg 768w, https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/Rank-Math-Sitemap-notice-on-Nginx-server-600x141.jpg 600w\" data-sizes=\"(max-width: 1015px) 100vw, 1015px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 1015px; --smush-placeholder-aspect-ratio: 1015\/238;\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">1. Add rewrite rules to the Nginx server<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">So go to the Nginx configuration file and add the following rewrite rule to fix the problem:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Modify the corresponding nginx site configuration file, usually in \/usr\/local\/nginx\/site-enables\/xxx.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Editing configuration files with vim<\/li>\n\n\n\n<li>Add the plugin's rewrite code before the } at the end.<\/li>\n\n\n\n<li>Save file<\/li>\n\n\n\n<li>Restart Nginx with the command systemctl restart nginx<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>Editing configuration files with vim\nAdd the plugin's rewrite code before the } at the end.\nSave the file\nRestart Nginx with the command systemctl restart nginx<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># START Nginx Rewrites for Rank Math Sitemaps\nrewrite ^\/sitemap_index.xml$ \/index.php?sitemap=1 last;\nrewrite ^\/([^\/]+?) -sitemap([0-9]+)? .xml$ \/index.php?sitemap=$1&amp;sitemap_n=$2 last;\nrewrite ^\/([a-z]+)? -sitemap\\.xsl$ \/index.php?xsl=$1 last;\n# END Nginx Rewrites for Rank Math Sitemaps<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">2. Clear sitemap settings<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After adding the above rewrite rule, you need to refresh the sitemap settings. To do this, go to Rank Math SEO \u2192 sitemap settings in the WordPress admin area and make some minor changes to the \"Number of links per sitemap\". Then click the \"Save Changes\" button.<\/p>\n\n\n\n<figure class=\"gb-block-image gb-block-image-2647d608\"><img decoding=\"async\" width=\"2406\" height=\"918\" class=\"gb-image gb-image-2647d608 lazyload\" data-src=\"https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/links-per-sitemap-2.jpg\" alt=\"Refresh sitemap setting\" title=\"links-per-sitemap-2\" data-srcset=\"https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/links-per-sitemap-2.jpg 2406w, https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/links-per-sitemap-2-300x114.jpg 300w, https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/links-per-sitemap-2-1024x391.jpg 1024w, https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/links-per-sitemap-2-768x293.jpg 768w, https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/links-per-sitemap-2-1536x586.jpg 1536w, https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/links-per-sitemap-2-2048x781.jpg 2048w, https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/links-per-sitemap-2-1320x504.jpg 1320w, https:\/\/virtualcardx.com\/wp-content\/uploads\/2025\/02\/links-per-sitemap-2-600x229.jpg 600w\" data-sizes=\"(max-width: 2406px) 100vw, 2406px\" src=\"data:image\/svg+xml;base64,PHN2ZyB3aWR0aD0iMSIgaGVpZ2h0PSIxIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjwvc3ZnPg==\" style=\"--smush-placeholder-width: 2406px; --smush-placeholder-aspect-ratio: 2406\/918;\" \/><\/figure>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">Reference:<a href=\"https:\/\/rankmath.com\/kb\/xml-sitemaps-nginx\/\" rel=\"nofollow noopener\" target=\"_blank\">https:\/\/rankmath.com\/kb\/xml-sitemaps-nginx\/<\/a><\/p>\n<\/blockquote>","protected":false},"excerpt":{"rendered":"<p>Rank Math dynamically creates a sit ... <\/p>\n<p class=\"read-more-container\"><a title=\"Nginx server build WordPress using Rank Math SEO plugin to generate Sitemaps need to do additional settings\" class=\"read-more button\" href=\"https:\/\/virtualcardx.com\/en\/2025\/02\/10\/nginx-\u670d\u52a1\u5668\u642d\u5efawordpress\u4f7f\u7528rank-math-seo\u63d2\u4ef6\u751f\u6210sitemaps\u9700\u8981\u8fdb\u884c\u7684\u989d\u5916\/#more-421\" aria-label=\"Read more about Nginx server build WordPress using Rank Math SEO plugin to generate Sitemaps need to carry out additional settings\">Read more<\/a><\/p>","protected":false},"author":1,"featured_media":423,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[],"class_list":["post-421","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/posts\/421","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/comments?post=421"}],"version-history":[{"count":0,"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/posts\/421\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/media\/423"}],"wp:attachment":[{"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/media?parent=421"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/categories?post=421"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/virtualcardx.com\/en\/wp-json\/wp\/v2\/tags?post=421"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}