允许文件夹,但不允许特定的子文件夹
Allow folder, but not specific sub-folders
对于 robots.txt,我们如何允许一个文件夹而不是特定的子文件夹或页面?
比如我的博客在/blog
里面,但是我想禁止/blog/wp-admin
。
下面的代码是否适用于我想要实现的目标?
Disallow: /blog/wp-admin
Allow: /blog
用
就够了
Disallow: /blog/wp-admin
这将禁止所有路径以 /blog/wp-admin
:
开头的 URL
https://example.com/blog/wp-admin
https://example.com/blog/wp-adminfoo
https://example.com/blog/wp-admin/
https://example.com/blog/wp-admin.php
https://example.com/blog/wp-admin/foo/bar
- …
允许抓取其他 URL 个,包括:
https://example.com/blog/wp-admi
https://example.com/blog/wp-adm
https://example.com/blog/wp-ad
https://example.com/blog/wp-a
https://example.com/blog/wp-
https://example.com/blog/wp
https://example.com/blog/w
https://example.com/blog/
https://example.com/blog
https://example.com/blo
- …
对于 robots.txt,我们如何允许一个文件夹而不是特定的子文件夹或页面?
比如我的博客在/blog
里面,但是我想禁止/blog/wp-admin
。
下面的代码是否适用于我想要实现的目标?
Disallow: /blog/wp-admin
Allow: /blog
用
就够了Disallow: /blog/wp-admin
这将禁止所有路径以 /blog/wp-admin
:
https://example.com/blog/wp-admin
https://example.com/blog/wp-adminfoo
https://example.com/blog/wp-admin/
https://example.com/blog/wp-admin.php
https://example.com/blog/wp-admin/foo/bar
- …
允许抓取其他 URL 个,包括:
https://example.com/blog/wp-admi
https://example.com/blog/wp-adm
https://example.com/blog/wp-ad
https://example.com/blog/wp-a
https://example.com/blog/wp-
https://example.com/blog/wp
https://example.com/blog/w
https://example.com/blog/
https://example.com/blog
https://example.com/blo
- …