A robots.txt file is a simple text file placed in the root directory of your website that tells search engine crawlers which pages or folders they are allowed or not allowed to crawl.
It follows the Robots Exclusion Protocol (REP).
Example:
https://www.example.com/robots.txt
Every major search engine such as Google, Bing, Yahoo, DuckDuckGo, and Yandex checks this file before crawling your website.
Although robots.txt does not directly improve rankings, it plays an important role in technical SEO.
It helps search engines:
When Googlebot visits your website:
Step 1:
Visits
example.com/robots.txt
↓
Step 2:
Reads the instructions
↓
Step 3:
Determines which URLs it can crawl
↓
Step 4:
Starts crawling permitted pages
Always place it in the root folder.
Correct
https://example.com/robots.txt
Wrong
https://example.com/files/robots.txt
https://example.com/images/robots.txt
Specifies which crawler the rule applies to.
Example
User-agent: Googlebot
For all search engines:
User-agent: *
Blocks crawling.
Example
Disallow: /admin/
Blocks
example.com/admin/
Allows crawling even inside blocked folders.
Example
Allow: /images/
Tells search engines where the XML Sitemap is located.
Example
Sitemap: https://example.com/sitemap.xml
Limits crawling speed.
Example
Crawl-delay: 10
Google ignores Crawl-delay but Bing supports it.
User-agent: *
Disallow:
User-agent: *
Disallow: /
Never use this on a live website.
User-agent: *
Disallow: /admin/
User-agent: *
Disallow: /login/
User-agent: *
Disallow: /*.pdf$
User-agent: *
Disallow: /search/
User-agent: Googlebot-Image
Allow: /uploads/
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
Disallow: /search/
Disallow: /cart/
Disallow: /checkout/
Sitemap: https://example.com/sitemap.xml
Using tool
Kingofseo FREE Robots.txt Generator tool Click Here
Open Notepad
↓
Save as
robots.txt
↓
Upload to the website root folder
Using cPanel
WordPress SEO Plugins
Upload directly into the website root directory.
Recommended:
User-agent: *
Disallow: /wp-admin/
Allow: /wp-admin/admin-ajax.php
Sitemap: https://example.com/sitemap.xml
User-agent: *Disallow: /private/
Disallow: /admin/
Sitemap: https://example.com/sitemap.xml
User-agent: *
Disallow: /cart/
Disallow: /checkout/
Disallow: /account/
Disallow: /search/
Sitemap: https://example.com/sitemap.xml
| Advantage | Description |
|---|---|
| Improves Crawl Budget | Google spends time on important pages |
| Faster Crawling | Eliminates unnecessary URLs |
| Better SEO | Important pages get crawled efficiently |
| Protects Admin Areas | Reduces unnecessary crawler access |
| Supports Sitemap | Helps search engines discover pages |
| Reduces Duplicate Content Crawling | Limits crawling of filter or search URLs |
| Saves Server Resources | Fewer unnecessary crawler requests |
| Easy to Implement | Simple text file with minimal setup |
#) to document complex rules.❌ Blocking the entire website
Disallow: /
❌ Blocking CSS
Disallow: /css/
❌ Blocking JavaScript
Disallow: /js/
❌ Forgetting Sitemap
❌ Wrong file name
Robot.txt
Correct
robots.txt
| Robots.txt | Meta Robots |
|---|---|
| Controls crawling | Controls indexing and link following |
| Site-level configuration | Page-level configuration |
| Stored as a text file | HTML meta tag |
| Can reduce crawl activity | Requires the page to be crawled to be seen |
| Robots.txt | Noindex |
|---|---|
| Prevents crawling | Prevents indexing |
| Search engines may still list the URL without content | URL is removed from search results when respected |
| Uses text file | Uses HTML meta tag or HTTP header |
Always include:
Sitemap: https://example.com/sitemap.xml
Benefits:
Open your browser:
https://yourdomain.com/robots.txt
✅ File exists at the root directory
✅ File name is exactly robots.txt
✅ Uses correct syntax
✅ Includes User-agent rules
✅ Blocks only unnecessary folders
✅ Allows important resources (CSS/JS)
✅ Includes XML Sitemap URL
✅ Tested after changes
✅ Reviewed after site redesign or migration
✅ Monitored through webmaster tools
It is a text file that tells search engine crawlers which areas of your website they can or cannot crawl.
Yes. It helps optimize crawl efficiency and crawl budget, which supports technical SEO.
No. It is not a security feature. Use authentication or proper access controls for private content.
In the root directory of your website (e.g., https://example.com/robots.txt).
Yes, but blocking your entire site with Disallow: / should only be used for staging or development environments.
No, but it is strongly recommended for most websites.
No. A website should have only one robots.txt file at the root.
No. Use a noindex directive (where supported) or other appropriate methods if you want pages removed from search results.
Generally, no. Search engines often need these files to render and understand your pages correctly.
Whenever your site structure changes or new sections need crawl management.
A well-configured robots.txt file is an essential part of technical SEO. It helps search engines focus on your most valuable content, improves crawl efficiency, conserves server resources, and guides crawlers to your XML sitemap. However, it should be used carefully—misconfigurations can unintentionally block important pages or resources.
Regularly review your robots.txt file, test any changes, and align it with your overall SEO strategy to ensure your website remains easily crawlable and indexable.