Home › Blog › What Is robots.txt? A Beginner Guide With Safe Examples
What Is robots.txt? A Beginner Guide With Safe Examples
robots.txt is a small text file at the root of your website, for example yoursite.com/robots.txt. It gives instructions to search engine crawlers about which areas they should and should not visit.
What it can do
You can use it to ask crawlers not to visit certain folders, such as an admin area or a search results page. You can also use it to point to your sitemap.
A simple safe example
A basic file has three lines: one that says User-agent with a star, meaning all crawlers; one that says Allow with a slash, meaning everything is allowed; and one that says Sitemap followed by your sitemap address. This is fine for most small sites.
The most dangerous mistake
If the file contains Disallow with a single slash, the whole site is blocked from crawling. This is sometimes left over from a test version of the site. If your new site is not on Google, check this first.
What it cannot do
robots.txt is not a lock. It does not hide pages from people, and a blocked page can still appear in search if other sites link to it. To keep a page out of search, use a noindex tag instead, and do not block that page in robots.txt, or Google will never see the tag.
How to test it
Open yoursite.com/robots.txt in your browser. Then use the robots.txt report in Google Search Console to see if Google could read it. A website checker also warns you when important pages are blocked.
Keep it simple
Most small sites need only a few lines. Every extra rule is another chance for a mistake, so change the file carefully.
Frequently asked questions
Where do I put robots.txt?
It must be in the root folder of your domain so that it opens at yoursite.com/robots.txt.
Can robots.txt remove a page from Google?
Not reliably. Use a noindex tag or the removal tool in Search Console.
Related articles
- What Is a Sitemap? How to Create and Submit It to Google
- Why Is My Website Not Showing on Google? 7 Reasons and Fixes
- What Is a Canonical Tag? How It Prevents Duplicate Content Problems
- How to Check If Your Website Is Indexed on Google (3 Easy Ways)
- How to Read the Google Search Console Performance Report
- How to Add Your Website to Google Search Console (Step by Step)
Free tools: Free website checker in Urdu · Free website speed test · Free SEO checker in Roman Urdu
Check my website free