How to write and submit a correct robots.txt

A correct robots.txt should live at the root of your site and requires the following things: At least one user agent, allow or disallow rules and a sitemap link.

Oscar de la Hera Gomez
Written by Oscar de la Hera Gomez
First published on 12/23/2023 at 05:03
Last Updated on 12/23/2023 at 07:52
<p>A flower that represents robots on the internet. Beneath it sits the text "Robots.txt."</p>

A correct robots.txt should live at the root of your site and requires the following things: At least one user agent, allow or disallow rules and a sitemap link.

Subscribe
<p>A screenshot of PageSpeed Insights that shows that I wrote a wrong robots.txt file.</p>

The following article intends to address the right way to write and submit robots.txt files. We are writing this after having submitted an incorrect robots.txt file that damaged our SEO.

Luckily, thanks to the good people at Google, we discovered how to write a correct robots.txt file and resolved our issue.

Visit PageSpeed Insights
<p>A screenshot of PageSpeed Insights showing that we resolved the robots.txt issue.</p>

Writing a Correct Robots.txt

A correct robots.txt file requires four things:

  • At least one user-agent
  • At least one allow or disallow rule
  • A site map

Examples of robots.txt for one or more user-agents can be found in the link below.

How to write and submit a robots.txt file

Please note that if the robots.txt file does not have the correct sitemap url, your SEO will be heavily damaged.

How to fix "Sitemap is not accessible" on Ahrefs in GatsbyJS

Submitting a correct robots.txt file

A robots.txt file must live on the root of your site.

If your domain is https://www.example.com then your robots.txt must be found at https://www.example.com/robots.txt.

Looking to learn more about ReactJS, GatsbyJS or SEO ?

Search our blog to find educational content on learning SEO as well as how to use ReactJS and GatsbyJS.

Search our Blog

Any Questions?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.
SubscribeContact UsVisit our BlogView our ServicesView our Work

Partner with us

We would love to get to know you and see how we can help your organization with its goals and needs.
Let's Talk

Stay Informed

Get occasional updates about our company, research, and product launches.
Subscribe