「SEO/robots.txt」の版間の差分

提供: 初心者エンジニアの簡易メモ
ナビゲーションに移動 検索に移動
 
(同じ利用者による、間の8版が非表示)
49行目: 49行目:
<pre>
<pre>
location ~* \.pdf$ {
location ~* \.pdf$ {
  add_header X-Robots-Tag "noindex, nofollow";
}
#絶対パス指定(/assets/img/test-min.pngなど)
location ~ /assets/img/*min\.png$ {
   add_header X-Robots-Tag "noindex, nofollow";
   add_header X-Robots-Tag "noindex, nofollow";
}
}
</pre>
</pre>
apache
apache
<pre>
<pre>
63行目: 60行目:
</pre>
</pre>
参考:https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag?hl=ja#apache
参考:https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag?hl=ja#apache
===絶対パス指定の場合(/assets/img/test-min.pngなど)===
nginx
<pre>
location ~ \/assets\/img\/*min\.png$ {
  add_header X-Robots-Tag "noindex, nofollow";
}
</pre>
===画像登録回避の曖昧表記===
<pre>
Disallow: /images/animal-picture-*.png
Disallow: /*.png$
</pre>
参考:https://developers.google.com/search/docs/crawling-indexing/prevent-images-on-your-page?hl=ja

2024年6月5日 (水) 20:57時点における最新版

robots.txtの書き方

画像検索ボットの排除

User-agent: Googlebot-Image
Disallow: /

User-agent: Yahoo-MMCrawler
Disallow: /

User-agent: *
Allow: /

サイトマップ登録

User-agent: *
Sitemap: http://example.com/sitemap.xml
Allow: /
Disallow: /js/
Disallow: /api/

ウェブ魚拓を拒否

User-agent: Megalodon
Disallow: /

不要bot排除

User-agent: MJ12bot
Disallow: /

User-agent: AhrefsBot
Disallow: /

User-agent: BLEXBot
Disallow: /

User-agent: Yandex
Disallow: /

User-agent: baiduspider
Disallow: /

User-agent: SemrushBot
Disallow: /

参考:https://oxynotes.com/?p=9056

画像を登録しない

nginx

location ~* \.pdf$ {
  add_header X-Robots-Tag "noindex, nofollow";
}

apache

<Files ~ "\.pdf$">
  Header set X-Robots-Tag "noindex, nofollow"
</Files>

参考:https://developers.google.com/search/docs/crawling-indexing/robots-meta-tag?hl=ja#apache

絶対パス指定の場合(/assets/img/test-min.pngなど)

nginx

location ~ \/assets\/img\/*min\.png$ {
  add_header X-Robots-Tag "noindex, nofollow";
}

画像登録回避の曖昧表記

Disallow: /images/animal-picture-*.png
Disallow: /*.png$

参考:https://developers.google.com/search/docs/crawling-indexing/prevent-images-on-your-page?hl=ja