あやしい MJ12bot のアクセスを規制する

サーバーMJ12bot,robots.txt,クローラーサーバー,MJ12bot,robots.txt,クローラー

記事ヘッダー_MJ12Botを規制する

最近になって、、、かどうかは定かじゃないんですが…、変なアクセスが増えてる形跡を見つけました。

今回は、そのアクセス対策をしてみます。

MJ12bot とは?

なんでしょうね?(笑

ユーザーエージェントにあった URL からサイトを見てみると、 Majestic というイギリスの会社が、Web上のリンクを解析しマッピングする…とかなんとかと、書いてありました。

Majestic is a UK based specialist search engine used by hundreds of thousands of businesses in 13 languages and over 60 countries to paint a map of the Internet independent of the consumer based search engines. Majestic also powers other legitimate technologies that help to understand the continually changing fabric of the web.

Web site owners can see data about their own websites on majestic.com.

MJ12Bot does not currently cache web content or personal data. Instead it maps the link relationships between websites to build a search engine. This data is available to technologies and the public, either by searching for a keyword or a website at Majestic. Details about the community project behind the crawlers are at Majestic12.co.uk.

https://mj12bot.com/

何が問題?

たまたま 404 アクセスのチェックをしていたとき、MJ12bot による多数のアクセスを見つけました。

MJ12bot によるアクセスの形跡
MJ12bot によるアクセスの形跡

解析自体は「勝手にやってくれ…」なんですけど、サイトマップに載せてないページや、既になくなっているページ等、隅から隅までクローリングしているようで、、、なんとなくウザいです。

まぁ、私のところは寂れたブログサイトなので、目に見えての被害はないのですが…、ほぼ無意味にアクセスされ、無駄なトラフィックが生まれてしまうのは嫌なので、規制してみようと思います。

MJ12bot 対策

ググってみると他のサイト運営者にも同様の被害?が出ているようで、併せて対策方法も紹介されてたので取り入れてみます。

robots.txt でクロールを拒否する

robots.txt に下記を追記するだけ。

User-agent: MJ12bot
Disallow: /

robots.txt は、「クローラー」というサービスを制御するためのものです。

誤った設定を施すと、Google など検索サイトからのクロールがされなくなり、検索結果に表示されなくなる…といったリスクもあるので、設置には注意が必要です。

ちなみに私のサイトでは、下記の内容で robots.txt を設置しています。(設置されているサイトなら http(s)://<domain>/robots.txt とアクセスすれば確認できます)

# MJ12bot measures
User-agent: MJ12bot
Disallow: /

# Other settings
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php

Sitemap: https://www.ushiblo.com/wp-sitemap.xml

Disallow: /images/wpo-plugins-tables-list.json

Sitemap: https://www.ushiblo.com/sitemap.xml

今回参考にさせて頂いたサイト様