Magento2 Sitemap.xml 显示为404 Nginx

在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

即可解决问题。

Leave a comment

您的电子邮箱地址不会被公开。 必填项已用 * 标注