Technical SEO: robots.txt, Sitemap and Canonical Tags
Technical SEO: robots.txt, Sitemap and Canonical Tags in Plain Words
Technical SEO

Technical SEO: robots.txt, Sitemap and Canonical Tags in Plain Words

Technical SEO is the code- and server-level setup that helps search engine crawlers move through pages without errors, understand them and add them to the index. Four basic tools handle this job: the robots.txt file, the sitemap.xml file, the canonical tag and 301/302 redirects. Below we go through each one: what it does, what its syntax looks like and which mistakes most often break indexing.

Key points in 30 seconds

  • robots.txt controls crawling: it tells crawlers which sections they don’t need to scan.
  • sitemap.xml is a list of important URLs that helps the search engine discover pages faster.
  • The canonical tag rel=”canonical” specifies the main version of a page and consolidates duplicates.
  • A 301 redirect is a permanent move that passes link equity; a 302 is temporary.
  • A mistake in any of these elements can block the entire site from indexing, so the setup should be checked after every release.

Crawling and indexing: how a search engine processes a site

Before a page appears in search, it goes through two stages. Crawling is the process where a search engine bot follows links, downloads the HTML of pages and discovers new URLs. Indexing is the next step: the system analyzes the content and adds the page to its database, after which it can be shown in the SERP.

It’s important to keep these stages apart: a page can be crawled but not indexed, for example if it has a noindex tag or is treated as a duplicate. On large sites, crawl budget comes into play: the limited number of URLs a bot is willing to crawl per visit. The technical tools below help direct that budget to important pages instead of wasting it on service pages.

robots.txt: what it is and how to set it up

robots.txt is a text file in the site root (available at site.com/robots.txt) that tells search engine crawlers which sections they don’t need to crawl. It controls crawling, not indexing, and that’s a fundamental difference.

The basic syntax consists of the directives User-agent (which bot the rule applies to), Disallow (what to block), Allow (what to permit) and a pointer to the sitemap:

User-agent: *

Disallow: /admin/

Disallow: /cart/

Allow: /

Sitemap: https://site.com/sitemap.xml

A common and dangerous mistake is leaving the directive Disallow: / (with a single slash), which blocks the whole site from crawling. This often happens when robots.txt is copied from a staging version to production. Another nuance: a page blocked in robots.txt can still end up in the index if external links point to it. To remove a page from search, use the noindex meta tag or a canonical tag, not robots.txt.

Sitemap.xml: a site map for crawlers

Sitemap.xml is an XML file listing the important URLs you want to see in the index. It doesn’t guarantee indexing and doesn’t directly affect rankings, but it speeds up page discovery, especially on new and large sites with deep nesting.

Besides URLs, the sitemap can include the last modified date (lastmod), which helps the crawler see which pages have been updated. Once created, the sitemap is submitted to Google Search Console and its URL is added to robots.txt.

Typical mistakes: adding pages blocked from indexing (noindex), non-existent URLs returning 404 or redirects to the sitemap, and forgetting to update it after the site structure changes.

The canonical tag: how to get rid of duplicates

The canonical tag rel=”canonical” tells the search engine which version of a page is the main one when identical or nearly identical content is available at several URLs. It goes in the <head> section:

<link rel=”canonical” href=”https://site.com/tovar/” />

Canonicals solve the problem of duplicates caused by catalog filters and sorting, UTM parameters, pagination, www and non-www versions, http and https. Good practice is to put a self-referencing canonical tag on every page (the page points to itself).

Common mistakes: the canonical points to a page with a redirect or a 404, every page on the site points to the homepage, canonicals conflict with a noindex tag. More on finding and fixing duplicates in the article on duplicate content and keyword cannibalization.

301 and 302 redirects: what’s the difference

A redirect automatically sends users and bots from one URL to another. For SEO, choosing the right type is critical.

Parameter301 (permanent)302 (temporary)
PurposeThe page has moved permanentlyThe page is temporarily unavailable at this URL
Link equityPasses almost all link equityLink equity is passed only partially
What happens in the indexThe old URL is replaced by the new oneThe old URL stays in the index
When to useURL change, www consolidation, http→https, migrationPromotion, A/B test, maintenance

The main mistake is using a 302 where a 301 is needed (for a permanent move): link equity isn’t consolidated and the old URL keeps competing with the new one. Redirect chains (URL A → B → C) are also dangerous: they waste crawl budget and lose some link equity at every hop. To learn how to move a site without losing rankings, read our guide on site migration.

Common technical SEO mistakes

  • Disallow: / in robots.txt, accidentally carried over from a staging server, blocks the entire site.
  • A noindex meta tag forgotten after development: pages don’t make it into search.
  • All canonicals point to the homepage: important pages drop out of the index.
  • Redirect chains and loops instead of one direct 301.
  • The sitemap includes blocked, non-existent or redirecting URLs.
  • Mixed http/https content after switching to the secure protocol.

How to check your setup

Most problems can be spotted in half an hour if you know where to look.

robots.txt: open site.com/robots.txt in a browser and make sure important sections aren’t blocked; Search Console has a dedicated testing tool.

Indexing: in Google Search Console, check the “Page indexing” report and use the URL Inspection tool. If pages aren’t getting indexed, work through the causes with the checklist in our article on why a site isn’t getting indexed.

Redirects and canonicals: run the site through a crawler; it will show all redirect chains, response codes and canonical tags in bulk. Sitemap: check it with a validator and make sure it opens and contains only working URLs.

Regular diagnostics are easiest to run in Search Console; how to set it up and read the reports is described in a separate guide on setting up Google Search Console.

All these checks are part of a technical SEO audit. When there are many pages, catching errors by hand takes a long time and it’s easy to miss something; it’s more systematic to order a technical SEO audit, which will find sections blocked from indexing, broken redirects and duplicates and give you a prioritized list of fixes. Want to make sure the technical side of your site isn’t holding back promotion? Leave a request for an SEO audit, and we’ll check robots.txt, the sitemap, redirects and canonicals for your project. The overview article what is link building also helps you see where technical SEO fits in the bigger picture.

Calculator

Estimate how much traffic growth your site needs

Pick a topic, the number of links and a period. The estimate updates instantly.

Country
Topic
Number of links
Period
Expected traffic growth:
Fill in all fields
Links per month:
Total links:
This is a rough estimate based on average market data. Actual results may vary depending on other factors.
Start today
Get -% more traffic in - months!
This is a rough estimate based on average market data. Actual results may vary depending on other factors.

FAQ

1. What matters more for indexing: robots.txt or a sitemap?
They're different tools. robots.txt restricts crawling (what not to scan), while sitemap.xml points the crawler to important URLs. Healthy indexing needs both: the sitemap so pages get discovered faster, robots.txt so crawl budget isn't wasted on service sections.
2. Can I block a page from indexing with robots.txt?
Not reliably. robots.txt blocks crawling, but the page can still get indexed through external links. To make sure a page is removed from search, use the noindex meta tag and don't block it in robots.txt, otherwise the crawler won't see the tag.
3. Does a small site need a sitemap?
For a site with 10–20 pages and good internal linking, a sitemap isn't critical, but it won't hurt: it speeds up discovery of new pages and helps the crawler see update dates. For online stores and sites with hundreds of URLs, a sitemap is a must.
4. What's the difference between a 301 and a 302 in simple terms?
A 301 means "moved permanently": the search engine replaces the old URL with the new one and passes link equity to it. A 302 means "temporarily unavailable": the old URL stays in the index. For permanent moves, you almost always need a 301.
5. What is a canonical tag and when do you need it?
rel="canonical" specifies the main version of a page when the same content is available at several URLs (filters, UTM parameters, www and non-www). It keeps the search engine from treating them as duplicates and concentrates link equity on one page.
6. How often should robots.txt and the sitemap be updated?
robots.txt is changed rarely, as new service sections appear. On most CMSs the sitemap updates automatically when pages are added; check it after every change to the site structure or after a migration.

Tools for this topic