How to write and submit a correct robots.txt

Oscar de la Hera Gomez
A flower that represents robots on the internet. Beneath it sits the text "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.

A screenshot of PageSpeed Insights that shows that I wrote a wrong robots.txt file.

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.

A screenshot of PageSpeed Insights showing that we resolved the robots.txt issue.

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.

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

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.

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.
delasign logo

Book a Free Consultation.

An icon of an email.

Click here to email us.

Fill in the details below to book a free consultation or to let us know about something else. Whatever it is, we are here to help.

How can we help you ?

Contact Details