Yoast Seo Sitemap not working

Hi i am using Yoast seo sitemap working url is

http://www.cetcounselling.in/sitemap_index.xml

all page n post urls http://cetcounselling.in are redirecting to http://www.cetcounselling.in

but http://cetcounselling.in/sitemap_index.xml

is not redirecting to

http://www.cetcounselling.in/sitemap_index.xml

can u please nginx code to redirect and location of the file to edit

Hello,

when I click on the links you have posted, I’m able to access to your sitemap. And when I use yourdomain.tld/sitemap.xml, I’m redirected to Yoast sitemap.

http://cetcounselling.in/sitemap_index.xml

CLick on this link it will land u into blank page not redirect to www version

Have you set the redirection from non www to www available in EE tutorials ?

server { server_name “~^(?!www.).*” ; return 301 $scheme://www.$host$request_uri; }

location of the file where we need to keep this

for all domains

You can add those directives in a new file, like redirection.conf in /etc/nginx/conf.d/

https://compareegg.in/sitemap_index.xml

Done the changes as said by you.

But it is not redirecting not working for https version

Edit the file /etc/nginx/conf.d/forcessl-compareegg.in.conf and replace return 301 https://yourdomain.tld$request_uri; by return 301 https://www.yourdomain.tld$request_uri;

Done the same. Not resolved

server { listen 80; server_name www.compareegg.in compareegg.in; return 301 https://www.compareegg.in$request_uri; }

done changes in forcessl-compareegg.in.conf

Still issue not resolved.

added file named allsites.conf in /etc/nginx/conf.d/

server { server_name “~^(?!www.).*” ; return 301 $scheme://www.$host$request_uri; }

still issue not solved.

Is there any correct solution for this.

to make this works https://compareegg.in/sitemap_index.xml to https://www.compareegg.in/sitemap_index.xml

server { listen 80; server_name www.compareegg.in compareegg.in; return 301 https://www.compareegg.in$request_uri; }

done changes in forcessl-compareegg.in.conf

Still issue not resolved.

added file named allsites.conf in /etc/nginx/conf.d/

server { server_name “~^(?!www.).*” ; return 301 $scheme://www.$host$request_uri; }

still issue not solved.

Is there any correct solution for this.

to make this works https://compareegg.in/sitemap_index.xml to https://www.compareegg.in/sitemap_index.xml

Hello,

yes, the last solution is :

 if ($host = yourdomain.tld) {
  return 301 https://www.yourdomain.tld$request_uri;
 }

server { if ($host = compareegg.io) { return 301 https://www.compareegg.io$request_uri; } }

I kept this code in allsites.conf file in the folder conf.d

still not working.

No, add it in /var/www/compareegg.io/conf/nginx/redirect.conf

Without server block

Yes Done the same. But no use.

I think some Issue there.

Even i use google xml sitemap it is redirecting to yoast sitemap url in other sites.

to disable yoast rewrite rules, you can comments the directives listed in /etc/nginx/common/wp-common.conf or wp-common-php7.conf

But personally, I’m redirected to www when I visit : http://cetcounselling.in/sitemap_index.xml

For http it is working fine. for https it is not working.

http://compareegg.in/sitemap_index.xml is redirection to https://www.compareegg.in/sitemap_index.xml

http://www.compareegg.in/sitemap_index.xml

is redirecting to https://www.compareegg.in/sitemap_index.xml

but

https://compareegg.in/sitemap_index.xml

is not redirecting. [no redirects found]

where as wordpress urls redirecting

https://compareegg.in/hyundai-hs4f33-gcr-cm-1-ton-3-star-split-ac-price/ perfectly redirecting to https://www.compareegg.in/hyundai-hs4f33-gcr-cm-1-ton-3-star-split-ac-price/

Hope the issue with https connection might be yoast seo rule

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;

causing the issue. even i tried removing it still not working

You can also perform the redirection by adding a page rule with Cloudflare.

I have many sites not using cloudflare.

Sir Is there any solution to resolve the yoast seo sitemap redirection issue for https (ssl) sites.