robots.txt
robots.txt文件是搜索引擎访问网站第一个要查看的文件。通过robots.txt文件搜索引擎可以确定哪些链接是搜索引擎可以访问的。哪些链接是不希望搜索引擎访问的。甚至可以告知允许哪些搜索引擎访问网站。相当于网站与搜索引擎之间的协议。在搜索引擎找到robots.txt文件后会以robots.txt来确定访问的范围。如果没有robots.txt文件。搜索引擎默认全部页面都是可以访问的。下面是我自己网站的robots.txt文件User-agent: *
Disallow:/api/
Disallow:/hapi/
Crawl-delay: 5
Sitemap: https://www.example.com/sitemap.xml
sitemap
sitemap文件就告诉搜索引擎网站有哪些链接以及链接的更新频率,sitemap可以为txt、html和xml格式
sitemap.xml
<?xml version="1.0" encoding="UTF-8"?>sitemap.txt
<urlset
xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9
http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"
>
<url>
<loc>http://www.example.com/test1/</loc>
<priority>0.3</priority>
<lastmod>2021-10-07</lastmod>
<changefreq>weekly</changefreq>
</url>
</urlset>
http://www.example.com/test1/sitemap.html
http://www.example.com/test2/
<!DOCTYPE html>
<head>
<title>网站地图</title>
<meta http-equiv="Content-type" content="text/html;" charset="UTF-8" />
<style>
body{font-family: Arial, "微软雅黑";font-size: 13px;}
ul, li{margin:0px; padding:0px; list-style:none;}ul{width:800px;margin-left: auto;margin-right: auto;}.title{width:800px;font-size: 18px;}.lks{float: left;padding-right: 15px;line-height: 30px;font-size: 16px;}
</style>
</head><body align="center">
<ul><li class="title"><h3>www.example.com网站地图:(2021-10-07)</h3></li>
<li class="lks">1、<a href="http://www.example.com/test1/" title="Example Domain" target="_blank">测试栏目</a></li>
</ul></body></html>
网友回复
python如何实现torrent的服务端进行文件分发p2p下载?
如何在浏览器中录制摄像头和麦克风数据为mp4视频保存下载本地?
go如何编写一个类似docker的linux的虚拟容器?
python如何写一个bittorrent的种子下载客户端?
ai能通过看一个网页的交互过程视频自主模仿复制网页编写代码吗?
ai先写功能代码通过chrome mcp来进行测试功能最后ai美化页面这个流程能行吗?
vue在手机端上下拖拽元素的时候如何禁止父元素及body的滚动导致无法拖拽完成?
使用tailwindcss如何去掉响应式自适应?
有没有直接在浏览器中运行的离线linux系统?
nginx如何保留post或get数据进行url重定向?