This content originally appeared on DEV Community and was authored by Ivan Jarkov
When it comes to SEO, many developers focus on page speed, structured data, and link building. But one small text file, often overlooked, can have a huge impact on how search engines see your site: robots.txt.
This file lives at the root of your domain (puzzlefree.game/robots.txt
) and tells search engine crawlers what they can and cannot index. A misconfigured robots.txt can either block important pages or accidentally expose areas you never wanted indexed.
Why robots.txt Is Important
- Controls crawl budget: Large websites can waste Googlebot’s crawl resources on duplicate or irrelevant pages (e.g., filters, internal search). A good robots.txt helps bots focus on what really matters.
-
Protects sensitive sections: While robots.txt is not a security tool, it can reduce indexing of areas like
/admin/
or/temp/
. - Supports SEO strategy: By guiding crawlers, you ensure the right pages rank, while low-value or duplicate content is ignored.
Basic Structure of robots.txt
Here’s the syntax you’ll use most often:
User-agent: *
Disallow: /private/
Allow: /public/
-
User-agent
: defines which bots the rule applies to (e.g.,Googlebot
,Bingbot
). Use*
for all. -
Disallow
: blocks access to a path. -
Allow
: grants access, even inside a blocked directory.
Common Examples
1. Block all crawlers from admin pages
User-agent: *
Disallow: /admin/
2. Allow everything except internal search results
User-agent: *
Disallow: /search
3. Block one crawler, allow others
User-agent: Googlebot
Disallow: /no-google/
User-agent: *
Allow: /
Mistakes to Avoid
Blocking the entire site
User-agent: *
Disallow: /
This tells all bots not to crawl anything. Some developers accidentally push staging robots.txt to production — and rankings disappear overnight.
Using robots.txt as a security measure
If you put/secret/
in your robots.txt, everyone (including bad actors) can see it. Use authentication, not robots.txt, for sensitive data.Forgetting sitemaps
Sitemap: https://puzzlefree.game/sitemap.xml
Best Practices
Keep it simple — don’t overcomplicate with unnecessary rules.
Always test your robots.txt in Google Search Console before deploying.
Combine robots.txt with meta robots tags or
noindex
headers for fine control.
Use
Sitemap:
to guide crawlers toward your best pages.
Final Thoughts
Your robots.txt is often the first file search engines see. Treat it as part of your SEO toolkit, not just a developer’s afterthought. A clean, intentional configuration ensures that crawlers spend their time on the content you actually want to rank.
This content originally appeared on DEV Community and was authored by Ivan Jarkov