robots.txt 常见坑及避坑指南打造安全防护网!
robots.txt 的作用
定义爬虫权限
- 网站的根目录下存在robots.txt ,搜索引擎蜘蛛会根据该文件中的内容确定访问范围
防止信息泄露
- robots.txt 文件可能会泄露网站的敏感目录或者文件,比如网站后台路径,从而得知其使用的系统类型,从而有针对性地进行利用
robots.txt 的常见坑
未正确放置robots.txt 文件
- 如果robots.txt 放在其他子目录中,就可能会导致爬虫在访问网站时无法发现该文件
通配符使用不当
- 通配符是robots.txt 文件为爬虫编写指令中所使用的特殊字符,其中有两个通配符可以在robots.txt 中使用,分别是“*”和“
字符,其中用于表示所有或任何字符串。
”用于表示URL结尾。因此,在使用通配符之前需要了解它们的工作原理再使用,不要使用不必要的通配符,否则最终阻止的不是单个URL而是整个文件夹
避坑指南
正确放置robots.txt 文件
- 请确保robots.txt 文件位于网站根目录下
合理使用通配符
- 在使用通配符之前需要了解它们的工作原理再使用,避免使用不必要的通配符
以上内容是根据搜索结果整理得出的,希望能够帮助您更好地理解和使用robots.txt 文件。
mjx-container[jax=”SVG”] {
direction: ltr;
}
mjx-container[jax=”SVG”] > svg {
overflow: visible;
min-height: 1px;
min-width: 1px;
}
mjx-container[jax=”SVG”] > svg a {
fill: blue;
stroke: blue;
}
mjx-container[jax=”SVG”][display=”true”] {
display: block;
text-align: center;
margin: 1em 0;
}
mjx-container[jax=”SVG”][display=”true”][width=”full”] {
display: flex;
}
mjx-container[jax=”SVG”][justify=”left”] {
text-align: left;
}
mjx-container[jax=”SVG”][justify=”right”] {
text-align: right;
}
g[data-mml-node=”merror”] > g {
fill: red;
stroke: red;
}
g[data-mml-node=”merror”] > rect[data-background] {
fill: yellow;
stroke: none;
}
g[data-mml-node=”mtable”] > line[data-line], svg[data-table] > g > line[data-line] {
stroke-width: 70px;
fill: none;
}
g[data-mml-node=”mtable”] > rect[data-frame], svg[data-table] > g > rect[data-frame] {
stroke-width: 70px;
fill: none;
}
g[data-mml-node=”mtable”] > .mjx-dashed, svg[data-table] > g > .mjx-dashed {
stroke-dasharray: 140;
}
g[data-mml-node=”mtable”] > .mjx-dotted, svg[data-table] > g > .mjx-dotted {
stroke-linecap: round;
stroke-dasharray: 0,140;
}
g[data-mml-node=”mtable”] > g > svg {
overflow: visible;
}
[jax=”SVG”] mjx-tool {
display: inline-block;
position: relative;
width: 0;
height: 0;
}
[jax=”SVG”] mjx-tool > mjx-tip {
position: absolute;
top: 0;
left: 0;
}
mjx-tool > mjx-tip {
display: inline-block;
padding: .2em;
border: 1px solid #888;
font-size: 70%;
background-color: #F8F8F8;
color: black;
box-shadow: 2px 2px 5px #AAAAAA;
}
g[data-mml-node=”maction”][data-toggle] {
cursor: pointer;
}
mjx-status {
display: block;
position: fixed;
left: 1em;
bottom: 1em;
min-width: 25%;
padding: .2em .4em;
border: 1px solid #888;
font-size: 90%;
background-color: #F8F8F8;
color: black;
}
foreignObject[data-mjx-xml] {
font-family: initial;
line-height: normal;
overflow: visible;
}
mjx-container[jax=”SVG”] path[data-c], mjx-container[jax=”SVG”] use[data-c] {
stroke-width: 3;
}
原创文章,作者:Ur47000,如若转载,请注明出处:https://wyc.retuba.cn/11586.html