How to Generate Robots.txt Files in WordPress [No Code] 

Would you like to know how to generate robots.txt files in WordPress?

A robots.txt file helps you control how search bots interact with your site. This makes it a very handy SEO tool for those who know how to use it.

In this article, we’ll show you how to generate a robots.txt file in WordPress.

What is a Robots.txt File

Robots.txt is a text file that website owners can create to tell search engine bots how to interact with their sites, mainly which pages to crawl and which to ignore. In essence, that acts as your site’s gatekeeper and is stored in the root directory (also known as the main folder) of your website. 

This is what it looks like:

Example of robots.txt

You can easily access your robots.txt file by visiting 

Here are some things you can use a robots.txt file for:

  • Control crawling
  • Direct indexing
  • Prevent duplicate content issues
  • Protect sensitive information
  • Optimizes crawl budget 
  • Enhances site performance 

Despite being a simple text file, having an optimized robots.txt file can significantly impact your SEO.

How to Generate a Robots.txt File In WordPress

Ready to generate robots.txt files?

The steps below will show you how to generate a custom robots.txt file. Don’t worry. No code or technical knowledge is needed.

Step 1: Install AIOSEO

The first step to generating custom robots.txt files is to install and activate All In One SEO (AIOSEO).

AIOSEO is a handy tool if you want to know how to generate robots.txt files in WordPress.

AIOSEO is a powerful yet easy-to-use SEO plugin that boasts over 3 million active installs. Millions of smart bloggers use AIOSEO to help them boost their search engine rankings and drive qualified traffic to their blogs. The plugin has many powerful features and modules to help you properly configure your SEO settings. Examples include:

  • Search Statistics: This powerful Google Search Console integration lets you track your keyword rankings and see important SEO metrics with 1-click, and more.
  • Next-gen Schema generator: This no-code schema generator enables users to generate and output any schema markup on your site.
  • Redirection Manager: Helps you manage redirects and eliminate 404 errors, making it easier for search engines to crawl and index your site.
  • Link Assistant: Powerful internal linking tool that automates building links between pages on your site. It also gives you an audit of outbound links.
  • SEO Preview: This gives you an overview of your search and social snippets and general SEO so you can improve your optimization.
  • IndexNow: For fast indexing on search engines that support the IndexNow protocol (like Bing and Yandex).
  • Sitemap generator: Automatically generate different types of sitemaps to notify all search engines of any updates on your site.
  • And more.

For step-by-step instructions on how to install AIOSEO, check out our installation guide.

And one of the most loved features is our advanced robots.txt editor. This powerful tool makes it easy to customize your robots.txt file to suit your needs. Plus, it also automatically adds your sitemap URLs to the robots.txt file!

Step 2: Access the Robots.txt Editor

Once you’ve activated AIOSEO, the next step is to access AIOSEO’s Robots.txt Editor. To do that, go to your AIOSEO menu and click Tools » Robots.txt Editor.

How to generate a robots.txt file in WordPress using AIOSEO.

Next, click on the Enable Custom Robots.txt toggle. Doing so enables you to edit your robots.txt file.

To generate robots.txt files, enable Custom Robots.txt.

Step 3: Add Robots.txt Directives

Once you’ve enabled editing of your robots.txt files, the next step is to add your custom directives.

These are the instructions you want search bots to follow. Examples include Allow, Disallow, Clean-param, and Crawl delay.

Robots.txt directives

Here’s what each directive means:

  • Allow: Allows user agents (bots) to crawl the URL.
  • Disallow: Disallows user agents (bots) to crawl the URL.
  • Clean-param: Tells search bots to ignore all URLs with the stipulated URL parameters.
  • Crawl-delay: Sets the intervals for search bots to crawl the URL.

In this section, you can also determine which user agents should follow the directive. You’ll also have to stipulate the value (URL, URL parameters, or frequency) of the directive.

Step 4: Import Robots.txt Directives from Another Site (Optional)

A simpler way to generate robots.txt files in WordPress is to use the Import function.

Import robots.txt

Clicking the Import button will open a window with 2 options for importing your chosen robots.txt file:

You can import a robots.txt file from a URL or copying and pasting the file into your editor.

Import from URL: Simply paste the URL of the robots.txt file you want to import ( and click Import. The robots.txt file will be imported to your site.

Paste Robots.txt text: Open the URL with the robots.txt file you want to import and copy the text. Next, go back to your site, paste it into the provided field, and click Import

This method is best if the site you’re importing the robots.txt file from has directives you would like to implement on your site.

Step 5: Test Your Robots.txt File

Once you’re done generating your robots.txt file, you can test it for any errors. However, this is very rare if you use AIOSEO’s robots.txt editor, as it has built-in rule validation and error handling.

Test for errors after generating robots.txt files.

However, if you want to double-check that there are no errors in your robots.txt file, you can use Google Search Console’s robots.txt testing tool. Simply enter your property, and the tool will automatically pull your robots.txt file and highlight any errors.

How to Generate a Robots.txt File In WordPress: Your FAQs Answered

What is the purpose of a robots.txt file?

A robots.txt file provides instructions to search engine crawlers about which parts of your website they are allowed to access and index. It helps control how search engines interact with your site’s content.

How can I generate robots.txt in WordPress?

You can easily generate a robots.txt file in WordPress using a plugin like All In One SEO (AIOSEO). You don’t even need coding or technical knowledge.

Can I manually create a robots.txt file for my WordPress site?

Yes, you can manually create a robots.txt file using a text editor and place it in your site’s root directory. This takes longer than using a plugin like AIOSEO and requires advanced WordPress knowledge.

We hope this post helped you know what robots.txt in WordPress is and why it’s important to optimize yours. You may also want to check out other articles on our blog, like our guide on crawling and indexing and its impact on SEO or our tips on improving your indexing on Google.

If you found this article helpful, then please subscribe to our YouTube Channel. You’ll find many more helpful tutorials there. You can also follow us on Twitter, LinkedIn, or Facebook to stay in the loop.  

Want to Try AIOSEO for Free?

Enter the URL of your WordPress website to install AIOSEO Lite.

Please enable JavaScript in your browser to complete this form.

Disclosure: Our content is reader-supported. This means if you click on some of our links, then we may earn a commission. We only recommend products that we believe will add value to our readers.

author avatar
Kato Nkhoma Content Writer
Kato is one of those rare unicorns born with a pen in his hand—so the legend says. He’s authored 2 books and produced content for hundreds of brands. When he’s not creating content for AIOSEO, you’ll find him either watching tech videos on YouTube or playing with his kids. And if you can’t find him, he’s probably gone camping.

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our privacy policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.