Notice: There is no legacy documentation available for this item, so you are seeing the current documentation.
Check out our video on how to use the Robots.txt tool here.
Are you looking to create a robots.txt file for your site? This article will help.
The robots.txt module in All in One SEO lets you manage the robots.txt that WordPress creates.
This enables you to have greater control over the instructions you give web crawlers about your site.
About the Robots.txt in WordPress
First, it’s important to understand that WordPress generates a dynamic robots.txt for every WordPress site.
This default robots.txt contains the standard rules for any site running on WordPress.
Second, because WordPress generates a dynamic robots.txt there is no static file to be found on your server. The content of the robots.txt is stored in your WordPress database and displayed in a web browser. This is perfectly normal and is much better than using a physical file on your server.
Lastly, All in One SEO doesn’t generate a robots.txt, it just provides you with a really easy way to add custom rules to the default robots.txt that WordPress generates.
Using the Robots.txt Editor in All in One SEO
To get started, click on Tools in the All in One SEO menu.
You should see the Robots.txt Editor and the first setting will be Enable Custom Robots.txt. Click the toggle to enable the custom robots.txt editor.
IMPORTANT:
You don’t need to enable the Custom Robots.txt unless you have a specific reason to add a custom robots rule.
The default robots.txt that is generated by WordPress is perfect for 99% of all sites. The Custom Robots.txt feature is for those users who need custom rules to block access to custom directories on their server.
You should see the Robots.txt Preview section at the bottom of the screen which shows the default rules added by WordPress.
Default Robots.txt Rules in WordPress
The default rules that show in the Robots.txt Preview section (shown in the screenshot above) ask robots not to crawl your core WordPress files. It’s unnecessary for search engines to access these files directly because they don’t contain any relevant site content.
If for some reason you want to remove the default rules that are added by WordPress then you’ll need to use the robots_txt filter hook in WordPress.
Adding Rules Using the Rule Builder
The rule builder is used to add your own custom rules for specific paths on your site.
For example, if you would like to add a rule to block all robots from a temp directory then you can use the rule builder to add this.
To add a rule, enter the user agent in the User Agent field. Using * will apply the rule to all user agents.
Next, select either Allow or Disallow to allow or block the user agent.
Next, enter the directory path or filename in the Directory Path field.
Finally, click the Save Changes button.
If you want to add more rules, then click the Add Rule button and repeat the steps above and click the Save Changes button.
Your rules will appear in the Robots.txt Preview section and in your robots.txt which you can view by clicking the Open Robots.txt button.
Editing Rules Using the Rule Builder
To edit any rule you’ve added, just change the details in the rule builder and click the Save Changes button.
Deleting a Rule in the Rule Builder
To delete a rule you’ve added, click the trash can icon to the right of the rule.
Robots.txt Editor for WordPress Multisite
There is also a Robots.txt Editor for Multisite Networks. Details can be found in our documentation on the Robots.txt Editor for Multisite Networks here.
NOTE:
Whilst the robots.txt generated by All in One SEO is a dynamically generated page and not a static text file on your server, care should be taken in creating a large robots.txt for two reasons:
- A large robots.txt indicates a potentially complex set of rules which could be hard to maintain
- Google has proposed a maximum file size of 512KB to alleviate strain on servers from long connection times.
Here’s a video on how to use the Robots.txt tool in All in One SEO: