1

1.html, 2.html, ..., [0-9]+.html(正規表現に関して) のような URL を許可しないようにするにはどうすればよいrobots.txtですか?

4

1 に答える 1

1

オリジナルの robots.txt 仕様は正規表現/ワイルドカードをサポートしていません。ただし、次のような URL をブロックできます。

  • example.com/1.html
  • example.com/2367123.html
  • example.com/3
  • example.com/4/foo
  • example.com/5/1
  • example.com/6/
  • example.com/7.txt
  • example.com/883
  • example.com/9to5
  • …</li>

と:

User-agent: *
Disallow: /0
Disallow: /1
Disallow: /2
Disallow: /3
Disallow: /4
Disallow: /5
Disallow: /6
Disallow: /7
Disallow: /8
Disallow: /9

1 つの数字の後に が続く URL のみをブロックするには、次のよう.htmlに を追加します。.html

User-agent: *
Disallow: /0.html
Disallow: /1.html
…

ただし、これはブロックしません。たとえば、example.com/12.html

于 2012-12-14T14:31:53.500 に答える