spinupwp / wordpress-nginx

Nginx server configurations for WordPress
605 stars 181 forks source link

Add Yoast SEO Sitemap XML Support #24

Open danielbarenkamp opened 6 years ago

danielbarenkamp commented 6 years ago

Please add the following lines to a global file for Yoast XML Support:

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

stefan0s commented 5 years ago

Hello,

I am trying to enable Yoast SEO and also add trailing slash to all urls.

Trailing slash

rewrite ^([^.]*[^/])$ $1/ permanent;

The problem i am having is that my root page http://www.domain.com is redirecting to http://www.domain.com/index.php/ adn not to http://www.domain.com/

also http://www.domain.com/sitemap.xml is not working.

Do you have nay solution on this?

stefan0s commented 5 years ago

I am also using expanded code for Yoast

Yoast SEO Sitemaps

location ~ ([^/])sitemap(.).x(m|s)l$ { rewrite ^/sitemap.xml$ /sitemap_index.xml permanent; rewrite ^/([a-z]+)?-?sitemap.xsl$ /index.php?xsl=$1 last; rewrite ^/sitemap_index.xml$ /index.php?sitemap=1 last; rewrite ^/([^/]+?)-sitemap([0-9]+)?.xml$ /index.php? sitemap=$1&sitemap_n=$2 last;

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; }

ThatMarko commented 5 years ago

+1

TimeJunkie01 commented 3 weeks ago

+1