How do I create a robots.txt?
There's different ways to create a robots.txt file. You can create it from your:
- Content Management System (CMS)
- Computer after which you upload it through your web server
Creating a robots.txt through your CMS
Oftentimes, modern Content Management Systems (CMS) have functionality to create and maintain your robots.txt file from within the CMS. If it doesn't come with the CMS by default, you can often find plugins to help with this.
WordPress + Yoast SEO
For example, the Yoast SEO plugin on WordPress support creating and maintaining the robots.txt file:
- Log into your
wp-admin
section. - In the sidebar, go to
Yoast SEO plugin
>Tools
. - Go to
File editor
.
WordPress + Rank Math
To create and maintain the robots.txt file in Rank Math SEO plugin:
- Log into your
wp-admin
section. - In the sidebar, go to
Rank Math
>General Settings
. - Go to
Edit robots.txt
.
WordPress + All in One SEO
And in All in One SEO Pack plugin, here's how you create a robots.txt:
- Log into your
wp-admin
section. - In the sidebar, go to
All in One SEO
>Robots.txt
.
Magento 2
In Magento 2, your robots.txt file is located here:
Content
>Configuration
(UnderDesign
).- There, edit the settings for
Main Website
instead of theDefault Store View
, because the latter won’t allow you to change the robots.txt file. - On the screen that follows, scroll down to
Search Engine Robots
. There you can define your robots.txt content:
Shopware 5
Because Shopware 5 doesn't come with a robot.txt editor out of the box, you'll need to install a plugin or make adjustments to the code that generates the robots.txt.
Creating a robots.txt on your computer
If you're not using a CMS, or the CMS doesn't support creating a robots.txt you can always create a robots.txt yourself and manually upload it to your web server.
- Open an editor like Notepad on Windows, or textEdit on Mac OS X.
- Create a new file.
- Copy-paste one of the example robots.txt files .
- Adjust the contents as needed.
- Save it with the filename
robots.txt
. - Upload it to your web server in your site's root directory.