Robots.txt is a plain text file at the root of your site, for example example.com/robots.txt. It gives crawlers instructions about which paths they may request.
Basic syntax
User-agent:names the crawler the rules apply to.*means all of them.Disallow:lists a path crawlers should not fetch.Allow:makes an exception inside a disallowed area.Sitemap:points to your XML sitemap.
A safe starting file
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
Sitemap: https://example.com/sitemap.xml
What it cannot do
Robots.txt is a request, not security. It does not hide private pages, and a blocked page can still appear in results if other sites link to it. To keep a page out of search, use a noindex tag or password protection.
Test before you publish
One wrong line like Disallow: / can hide your entire site. Use the robots.txt checker to test whether a path is allowed for a specific crawler before and after you make changes.
Key takeaways
- Keep the file short and test every change.
- Robots.txt is not security, so never rely on it to hide anything.
- Use noindex, not Disallow, to keep a page out of results.

Comments