Why semrushbot and ahrefsbot are blocked by default?

Did you try this (but use your container name)?

Note: you can also configure this in the Admin UI:

# docker exec -it socket-only bash
root@socket-only:/# rails c
[1] pry(main)> SiteSetting.blocked_crawler_user_agents
=> "mauibot|semrushbot|ahrefsbot|blexbot|seo spider"
[2] pry(main)> SiteSetting.blocked_crawler_user_agents = ""
=> ""
[3] pry(main)> SiteSetting.blocked_crawler_user_agents
=> ""
[4] pry(main)> 

See also:

See also:

  def self.allow_crawler?(user_agent)
    return true if SiteSetting.allowed_crawler_user_agents.blank? &&
      SiteSetting.blocked_crawler_user_agents.blank?
...
...

You can see from the code that if you set these two site settings to “blank” then there will be no blocking:

  • SiteSetting.allowed_crawler_user_agents
  • SiteSetting.blocked_crawler_user_agents

I recommend you do not change this because these bots which are blocked by Discourse core by default do not respect robots.txt; however, it’s your site and so you can do as you wish. There is a good reason they are blocked in core.

Having said that, Discourse gives you the option to “unblock” these using your SiteSettings in the UI.