How To Write A Robots.txt File In Yoast Seo

Creating a robots.txt file is a crucial task in maximizing your website’s SEO. This article will walk you through the steps of making a custom robots.txt file for Yoast SEO, accompanied by my own personal tips and observations.

What is a robots.txt file?

A robots.txt file is a text file that tells search engine bots which pages or directories on your website they should or should not crawl. It allows you to control how search engines access and index your website’s content. By utilizing a robots.txt file, you can improve the visibility of your website in search engine results and ensure that search engines focus on indexing your most important pages.

Creating a robots.txt file for Yoast SEO

When using the Yoast SEO plugin, you can easily create and manage your robots.txt file within the plugin’s settings. Here is a step-by-step guide to help you through the process:

  1. First, make sure you have Yoast SEO installed and activated on your WordPress website.
  2. Login to your WordPress admin dashboard and navigate to the Yoast SEO settings by clicking on “SEO” in the left-hand menu.
  3. Once you are in the Yoast SEO settings, click on the “Tools” tab at the top of the page.
  4. Scroll down to the “File editor” section and click on “Open the file editor” button.
  5. In the file editor, you will see two sections: “Robots.txt file” and “Custom robots.txt rules”.
  6. If you have already created a robots.txt file, you can edit it in the “Robots.txt file” section. If you don’t have one yet, click on the “Create robots.txt file” button.
  7. In the “Robots.txt file” section, Yoast SEO will provide you with a default template. You can customize this template according to your website’s needs.
  8. Once you have made any necessary changes, click on the “Save changes to robots.txt” button.
  9. Your robots.txt file is now created and saved. Yoast SEO will automatically handle the necessary technicalities to ensure that search engines can access it.

Important considerations when writing your robots.txt file

While creating your robots.txt file, there are a few important considerations to keep in mind:

  • Be cautious with disallowing entire directories or pages. Make sure you don’t accidentally block search engines from accessing important content.
  • Double-check the syntax of your robots.txt file. Even a minor mistake can render it ineffective or cause unintended consequences.
  • Regularly review and update your robots.txt file as your website evolves and new content is added.
  • Use the “Allow” rule sparingly. It is generally better to rely on the default behavior of search engine bots rather than explicitly allowing specific pages.


Creating and optimizing a robots.txt file is a crucial step in improving the SEO of your website, and with Yoast SEO, the process becomes even more streamlined. By following the steps outlined above, you can take control of how search engines crawl and index your website, enhancing its visibility and organic search rankings. Remember to always consider the impact of your robots.txt rules and regularly review and update them as needed.