Local Community

Rank Math plugin requesting adding code to NGINX server configuration file

Issue Summary

Rank Math plugin requesting adding code to NGINX server configuration file

Troubleshooting Questions

-1) I’m not a developer. Just trying to decide if adding this code is wise or not

-2) the full notice:
" Since you are using an NGINX server, you may need to add the following code to your configuration file if your Sitemap pages are not loading . If you are unsure how to do it, please contact your hosting provider"

-3) the code itself:

 # START Nginx Rewrites for Rank Math Sitemaps
 rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
 rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
 # END Nginx Rewrites for Rank Math Sitemaps

-4) I just want to make sure the site map works when I migrate my localhost to my host kinsta.


not relevant

System Details

  • Which version of Local is being used? 6.10+5452

  • What Operating System (OS) and OS version is being used?

    • For example: macOS Catalina or Windows 10 Professional
      MacOS 15.1
  • Attach the Local Log. See this Community Forum post for instructions on how to do so:

I don’t think this will hurt anything if it’s added to the conf/nginx/site.conf.hbs file within Local and the site restarted. What it’s basically doing is converting a url into query parameters for the plugin to use.

I’d start by testing to see if you need to add that rule. If it isn’t working, then go ahead and add it.

That’s a harder question to answer, and probably something you’ll need to ask at Kinsta. They likely have some way of adding this rule to their NGINX config.

But zooming out a bit, doing this sort of thing feels fragile to me. What you’re doing is adding server or environment configuration to provide core pieces of functionality.

I think that WP core comes with a basic sitemap generator, and other tools like Yoast offer some really great tooling around what things get added to a sitemap. It’s possible that Rank Math has many other good tools, but the fact that they require server level tweaks for their main functionality seems overkill. That being said, maybe there are good reasons for them to recommend that, but going this route means you have to be more mindful of configuring the various environments when things are deployed!

Thank Ben. You nailed it! I’m holding off for now. ‘too fragile’ resonates with my instincts.

1 Like

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.