1.创建sitemap.xml
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://www.***.com/global</loc> # 网址-1
</url>
<url>
<loc>https://www.***.com/global/</loc> # 网址-2
</url>
......
</urlset>
2.创建robots.txt(允许所有检索器来抓网站,告诉索引器 Sitema.xml 档案在哪个位置。)
User-agent: *
Disallow:
Sitemap: https://www.***.com/sitemap.xml
3.nginx匹配请求映射到实际的文件路径
location ~ ^/global/sitemap-(\w+)\.xml$ {
alias /home/wwwroot/sitemaps/sitemap-$1.xml;
}
location /robots.txt {
alias /home/wwwroot/sitemaps/robots.txt;
}
4.服务器重载nginx配置
5.提交sitemap到google
参考地址: