What Is a Robots.txt File?

What is a robots.txt file? This small file tells Google and other bots what parts of your website they can and can't crawl. For most WordPress websites, just a few lines of code are needed. Learn what to include in your robots.txt file, how to make changes, and how to help Google find the content you want to have ranking.
TL;DR / Quick Summary

A robots.txt file gives Google and other bots rules to follow when crawling your website. For most WordPress websites, just a few lines of code are needed. WordPress creates a basic robots.txt file for you, but you can make changes as needed.

  • What Is a Robots.txt File? A small text file that tells bots what parts of your website they can and can’t crawl.
  • What Should Be in Your Robots.txt File? Most WordPress websites need only a few rules to guide bots, along with a link to the XML sitemap.
  • How Do You Edit a Robots.txt File? You can edit the file through Yoast SEO in WordPress or through File Manager in cPanel.
  • Can Robots.txt Keep Pages Out of Google? Not always. If you don’t want a page to rank on Google, the Noindex setting is a better option.
  • Is Robots.txt a Security Tool? No. Not all bots follow the rules in a robots.txt file, so it should never be used to secure private pages or files.

Next Steps: Need help managing the technical parts of your WordPress website? Check out our website hosting and maintenance packages or reach out to Full Scope Creative for help.

Understanding Robots.txt Files in WordPress

If you’ve spent some time working on the SEO for your website, you heard of the robots.txt file. Robots.txt is a small text file that tells Google what parts of your website it can and can’t crawl.

As small as the file is (only four lines of code for most websites), it can have a great impact on your website and SEO. On a WordPress website, we have a couple easy ways to manage this file.

How Does a Robots.txt File Work?

When Google goes to your website, it uses a  bot to crawl and index the site. That bot visits as many pages as it can find links to, and reads the content on the pages. This is referred to as crawling a website.

The robots.txt file gives the bots (that will obey them) a set of rules to follow. Think of it like a sign on a door that says “Employees Only.” You want people to come into your business, but there are some rooms they don’t need to go into.

The same goes for your website. We want Google to crawl our service pages, blogs, and other great content. Google doesn’t need to crawl all the files we use to manage our WordPress website.

Let Us Help Manage Your WordPress Website

From setting up your robots.txt file to managing WordPress updates and website security, there’s a lot that goes into managing a website. With website hosting from Full Scope Creative, you have a team you can reach out to for help with all those technical parts of your website.

What Should Be in My Robots.txt File?

For most small business websites built with WordPress, we don’t need much in our robots.txt file. Here’s a good starting point for a WordPress website using Yoast SEO:

User-agent: *

Disallow: /wp-admin/

Allow: /wp-admin/admin-ajax.php

Sitemap: https://example.com/sitemap_index.xml

Let’s look at what each of those four lines does.

  • User-agent: * tells all bots that these rules are for them.
  • Disallow: /wp-admin/ tells the bots not to crawl the WordPress admin folder.
  • Allow: /wp-admin/admin-ajax.php gives bots access to a file that some WordPress features need to work.
  • Sitemap: tells the bots where to find the XML sitemap for the website.

Be sure to change example.com to your own domain name and check that the link to your sitemap works. If you’re not using Yoast SEO, you might have a different link for your sitemap.

There may be other lines of code you’ll need for your website, but for many small business websites, this is a good setup.

Can I Use Robots.txt to Block Certain Pages?

There are some pages on our Full Scope Creative website that we use as part of our sales process. We also have some pages we use to ask clients for reviews. Those aren’t pages we’re looking to have rank on Google.

We have clients with pages where their staff can log in to the website. Those are other pages we don’t really need Google to crawl.

If we wanted to ask bots not to crawl a team login page, we could add a line like this to our robots.txt rules:

Disallow: /team-login/

There is one thing to keep in mind with this. Telling Google not to crawl a page doesn’t mean that the page can’t show up in search results.

If our goal is to keep a page out of Google search results, we’d use a setting called Noindex. With Yoast SEO, we can set that on each page. We still need to let Google crawl the page so it can see that setting.

And by no means should you use a robots.txt file as a way to keep a page secure. Not all bots follow the rules we give them.

How to Find Your Robots.txt File

You can view the robots.txt file for your website without having to log in to WordPress. Simply go to your website and add /robots.txt to the end of your domain name.

You can even view the robots.txt file for Google this way.

WordPress will make a basic robots.txt file for you if you don’t already have one. So even if you’ve never set one up, there’s a good chance you already have one.

How to Edit a Robots.txt File in WordPress

There are a few ways to edit your robots.txt file. When we need to make changes to one, we generally use either Yoast SEO or cPanel.

With Yoast SEO, you can go to Tools and then File Editor. From there, you can create or edit your robots.txt file. This is probably the easiest way for most WordPress users to make changes.

If your website host uses cPanel, you can also edit the file through File Manager. The robots.txt file goes in the main folder for your website (often called public_html).

You might be wondering if you can edit the file through the WordPress Theme File Editor. While a developer can use code in a theme to change the rules WordPress creates, you can’t edit the robots.txt file itself through the theme editor. I’d stick with Yoast SEO or cPanel.

If you’re not sure how to do any of this, your website host should be able to help. If yours can’t, I know a good one to recommend.

Make Sure Google Can Crawl Your Website

We spend a lot of time writing content and building websites that we want Google to find. The last thing we want to do is tell Google not to look at any of it.

A simple mistake in a robots.txt file can stop Google from crawling your entire website. One of the things worth checking when a new website goes live is that the robots.txt file is set up right.

For most WordPress websites, there’s very little work that needs to be done on this file. Get it set up right, check it from time to time, and let Google do its job.

From custom web design, hosting, and SEO to complete brand identity, Full Scope Creative helps growing businesses stand out and scale.
Ready to get started? Fill out the short form below, and we’ll reach out to discuss your project.
Contact Us

Prefer to call, email, or swing by the office? Connect with our team here →

Let Us Help Manage Your WordPress Website

From setting up your robots.txt file to managing WordPress updates and website security, there’s a lot that goes into managing a website. With website hosting from Full Scope Creative, you have a team you can reach out to for help with all those technical parts of your website.

Recent Blogs

Monthly Blog Archive

Chris and his team at Full Scope Creative are the best! I have worked with Chris on two different projects. The first project was updating a website and the second project we started a website from scratch. Both are incredibly challenging without the knowledge and expertise of someone like Chris, but Chris and his team made the process exciting with all of his great ideas. Great ideas, responsive, quick turnaround time. Thank you, Chris for being so kind and so great at what you do!

~ Sarah Lueschow,
MHO Open, Inc.