XML Sitemaps on NGINX (WordPress)

This article is only applicable to the cloud hosting packages (which are based on NGINX).

If you are using our cloud hosting servers and would like to use a SEO plugin that generates a XML sitemap for your website, please follow the steps described in this article, based on the plugin used.

  1. Login to the cloud panel.
  2. Click Applications in the main menu and click on the desired domain.
  3. Click Site Settings in the application menu and scroll to the bottom of the page.
  4. Click the Custom Server Directives tab.

In order for the sitemap to start working, the following code needs to be added into the Custom Server Directives field, based on the plugin you are using. We have prepared the required code for some of the most popular SEO plugins out there.

After inserting the code in to the mentioned field, save the changes and wait up to one minute. The sitemap should now be accessible.

Yoast SEO plugin / Rank Math

If you are using the Yoast SEO or Rank Math plugin, insert the following code into the Custom Server Directives field:

rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last;
rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;

The SEO Framework

The SEO Framework requires a different code that needs to be added to the Custom Server Directives field.

rewrite ^/sitemap.xml$ /index.php?the_seo_framework_sitemap=xml last;
rewrite ^/sitemap.xsl$ /index.php?the_seo_framework_sitemap=xsl last;

Google XML Sitemaps

Only use the following code if you are using the WordPress plugin Google XML Sitemaps. Ensure that it is enabled before trying to access the sitemap.

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;

Other plugins

In case you are using another plugin and your sitemap is not working, please contact our customer support.

Leave a Comment

Your email address will not be published. Required fields are marked *