在Magento2 上面创建了sitemap.xml .生成了文件,但是在浏览器上不能访问。google 也抓取不到。解决办法如下:
在nginx.conf.sample 里面添加下面代码
#sitemap
location /sitemap.xml{
alias /var/www/html/dreshoes/sitemap.xml;
}
然后检查nginx配置,重新启动nginx
root@iZ0xi56mdbsvc34ma2xdr8Z:/var/www/html/dreshoes# nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
root@iZ0xi56mdbsvc34ma2xdr8Z:/var/www/html/dreshoes# nginx -s reload
即可解决问题。