• Hi, I have a website running on nginx. Currently my site has more than 900 articles. I want to split my sitemap post by year. However, when I setting the plugin that split the article sitemap by year, my sitemap is not accessible, it returns 404 nginx error. Here is my sitemap link:
    https://mcpebox.com/sitemap.xml
    Previously, the site map link for the post was still accessible here: https://mcpebox.com/sitemap-posttype-post.xml
    After I split the post sitemap by year, the new link https://mcpebox.com/sitemap-posttype-post.2020.xml is not accessible.

    Here is my nginx.conf rule:

    # Yoast sitemap
    location ~ ([^/]*)sitemap(.*)\.x(m|s)l$ {
      rewrite ^/sitemap\.xml$ /sitemap_index.xml permanent;
      rewrite ^/([a-z]+)?-?sitemap\.xsl$ /index.php?xsl=$1 last;
      # Rules for yoast sitemap with wp|wpsubdir|wpsubdomain
      rewrite ^.*/sitemap_index\.xml$ /index.php?sitemap=1 last;
      rewrite ^.*/([^/]+?)-sitemap([0-9]+)?\.xml$ /index.php?sitemap=$1&sitemap_n=$2 last;
      # Following lines are options.
      rewrite ^/news_sitemap\.xml$ /index.php?sitemap=wpseo_news last;
      rewrite ^/locations\.kml$ /index.php?sitemap=wpseo_local_kml last;
      rewrite ^/geo_sitemap\.xml$ /index.php?sitemap=wpseo_local last;
      rewrite ^/video-sitemap\.xsl$ /index.php?xsl=video last;
      access_log off;
    }
    
    #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;

    Can you help me to solve this problem?

  • The topic ‘404 Not Found Nginx’ is closed to new replies.