Sitemap redirecting to homepage | WordPress.org

I’m using The SEO Framework plugin on a new WordPress site, and cannot reach my sitemap, it redirects to my homepage.

According to your documentation, the plugin generates the sitemap dynamically, so I’m not sure if my NGINX configuration blocks the PHP that generates the sitemap or if my NGINX configuration is redirecting to the homepage due to another reason.

I have tried disabling various aspects of my configuration, as well as adding the following two blocks, and neither worked.

location = /sitemap.xml {
    rewrite ^/sitemap.xml$ "/?the_seo_framework_sitemap=xml" permanent;
}
rewrite ^/sitemap\.xml$ /index.php?the_seo_framework_sitemap=xml last;
rewrite ^/sitemap\.xsl$ /index.php?the_seo_framework_sitemap=xsl last;

My current NGINX config:

# Redirect HTTP -> HTTPS
server {
    listen 80;
    server_name example1.ca www.example1.ca example2.ca www.example2.ca;

    return 301 https://example1.ca$request_uri;
}

server {
    listen 443 ssl http2;
    server_name example2.ca;
    return 301 https://example1.ca$request_uri;
# SSL parameters
    ssl_certificate /etc/nginx/ssl/example2-fullchain.pem;
    ssl_certificate_key /etc/nginx/ssl/example2-privkey.pem;
    ssl_trusted_certificate /etc/nginx/ssl/example2-chain.pem;
    include /etc/nginx/snippets/security.conf;
}

server {
    listen 443 ssl http2;
    server_name example1.ca;
    root /var/www/html/;
    index index.php;

# SSL parameters
   ssl_certificate /etc/nginx/ssl/fullchain.pem;
   ssl_certificate_key /etc/nginx/ssl/privkey.pem;
   ssl_trusted_certificate /etc/nginx/ssl/chain.pem;

# security config
   include /etc/nginx/snippets/security.conf;

#wordfence
location ~ ^/\.user\.ini {
deny all;
}

autoindex off;

# additional config
  include /etc/nginx/snippets/general.conf;
  include /etc/nginx/snippets/wordpress.conf;
#  include /etc/nginx/snippets/maintenance.conf;

# added error page
error_page 404 = @notfound;

# 301 permanent redirection
location @notfound {
    return ;
}

# Unwanted http
if ($request_method !~ ^(GET|HEAD|POST)$ )
{
return 405;
}

# log files
    access_log /var/log/nginx/example1.ca.access.log;
    error_log /var/log/nginx/example1.ca.error.log;

    location = /favicon.ico {
        log_not_found off;
        access_log off;
    }

    location = /robots.txt {
        allow all;
        log_not_found off;
        access_log off;
    }

 location / {
    try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_pass unix:/run/php-fpm/www.sock;
        fastcgi_index   index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

        location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg)$ {
        expires max;
        log_not_found off;
    }
}

WordPress conf:

location ~* /wp-content/uploads/woocommerce_uploads/ {
    if ( $upstream_http_x_accel_redirect = "" ) {
        return ;
    }
    internal;
}

location ~* ^/(?:wp-content|wp-includes)/.*\.php$ {
    deny all;
return ;
}

location ~* ^/wp-content/uploads/.*\.(?:s?html?|php|js|swf)$ {
    deny all;
return ;
}

location = /wp-admin {
return 301 /wp-admin/;
}

location /wp-content/ {
location ~ \.php$ {
   return ;
   }
 }

location ~ /\. {
  deny all;
 }

General conf:

# Gzip Settings
        gzip on;
        gzip_static on;
        gzip_disable "msie6";
        gzip_http_version 1.1;
        gzip_vary on;
        gzip_comp_level 6;
        gzip_proxied any;
        gzip_min_length 256;
        gzip_types
 # text/html is always compressed by HttpGzipModule
        text/css
        text/javascript
        text/xml
        text/plain
        text/x-component
        application/javascript
        application/x-javascript
        application/json
        application/xml
        application/rss+xml
        application/atom+xml
        font/truetype
        font/opentype
        application/vnd.ms-fontobject
        image/svg+xml;
        gzip_buffers 16 8k;

Any help would be great!

Thanks
Brad

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer