Posilte SEO pomocí robots.txt: zlepšete výkon webu chytřejším řízením crawlerů
Řízení crawlerů hraje důležitou roli v SEO i výkonu webu. Crawlery vyhledávačů procházejí web a shromažďují informace potřebné k zobrazování stránek ve výsledcích vyhledávání.
Hlavním nástrojem pro tuto oblast je robots.txt. Tento článek podrobně vysvětluje robots.txt od základů přes praktické použití, upozornění a pokročilé techniky.

Kapitola 1: Základy robots.txt

Co je robots.txt? Jak funguje řízení crawlerů
Robots.txt je soubor prostého textu umístěný v kořenovém adresáři webu. Říká crawlerům, které části webu mohou procházet a které by procházet neměly.
Když crawler přistoupí na web, obvykle nejprve přečte robots.txt a poté web prochází podle těchto pokynů. Robots.txt je požadavek vůči crawlerům, nikoli nucené blokování.
Kam umístit robots.txt, formát souboru a znaková sada
Robots.txt musí být umístěn v kořenovém adresáři webu, například https://example.com/robots.txt.
Nebude fungovat, pokud jej umístíte do podadresáře. Název souboru musí být také malými písmeny: robots.txt.
Formát souboru musí být prostý text a důrazně se doporučuje kódování UTF-8. Při jiném kódování mohou crawlery soubor špatně interpretovat.
Základní syntaxe: User-agent, Disallow, Allow a detaily pravidel
Robots.txt se zapisuje pomocí direktiv, jako jsou User-agent, Disallow a Allow. Tyto direktivy rozlišují velikost písmen a píší se po jednom na řádek.
User-agent:
Specifies which crawler a rule applies to. You can name a specific crawler or use * for every crawler. By declaring multiple User-agent lines, you can define different rules for different crawlers. Examples:
User-agent: Googlebot,
User-agent: Bingbot,
User-agent: *.
Disallow:
Specifies a path that must not be crawled. It is written as a relative path beginning with a slash. An empty Disallow line means everything is allowed. Examples:
Disallow: /private/,
Disallow:.
Allow:
Specifies a path that may be crawled. It is used when you want to allow part of a location that has been blocked with Disallow. An Allow rule takes precedence over Disallow in that case. Example:
Disallow: /private/and
Allow: /private/public.html.
Používání zástupných znaků (*) a ($): flexibilní shoda cest a pokročilé použití
The asterisk matches any character string. For example, Disallow: /*.pdf blocks every PDF file, and Disallow: /images/*.jpg$ blocks only JPG files under the /images/ directory.
The dollar sign matches the end of a line. For example, Disallow: /blog/$ blocks access to the /blog/ directory itself while still allowing addresses such as /blog/article1/.
Nastavení Crawl-delay: snížení zátěže serveru a vliv na Googlebot
Direktivou Crawl-delay můžete určit interval mezi požadavky crawleru v sekundách. Může pomoci při vysoké zátěži serveru, ale Googlebot ji oficiálně nepodporuje.
Because Google has improved its automatic crawl-rate adjustment, and in line with a broader effort to simplify the user experience, Google is ending support for the crawl rate limiter tool in Search Console.
Planned end of support for the crawl-rate limiter tool in Search Console
Na jiné crawlery však stále může mít vliv.
Určení Sitemap: navádění crawlerů a práce s více sitemapami
You can specify sitemap URLs with the Sitemap directive. This helps crawlers understand the structure of the website more easily and improves crawl efficiency. You can also specify multiple sitemaps. Examples: Sitemap: https://example.com/sitemap.xml and Sitemap: https://example.com/sitemap_images.xml.
★
Posilte SEO: vytvořte strukturu webu přívětivou pro Google pomocí sitemap.xml
Kapitola 2: Praktické příklady robots.txt

Ochrana stránek vyžadujících přihlášení: Disallow: /member/
Obsah vyžadující přihlášení, například stránky jen pro členy, by měl být obecně vyloučen z indexování vyhledávači.
By using robots.txt, you can prevent crawlers from accessing these pages and reduce wasted crawling. For example, if members-only content is stored under /member/, writing Disallow: /member/ blocks access to every file and subdirectory under that location.
Robots.txt je však pouze požadavek vůči crawlerům, takže škodlivé crawlery jej mohou ignorovat.
Skutečně citlivé informace musí být chráněny serverovou autentizací, nikoli pouze robots.txt.
Řízení URL s parametry: Disallow: /*?page=*
Parameterized URLs can sometimes make the same content accessible under multiple URLs, which may be treated as duplicate content. For example, if you use a ?page= parameter for pagination, you may end up with pages like example.com/blog?page=1 and example.com/blog?page=2 that have different URLs but almost the same content.
By writing Disallow: /*?page=*, you can block access to every URL that includes the page= parameter. However, this can remove all paginated content from search engines and may hurt SEO.
Lepším přístupem je použít kanonický tag a označit kanonickou URL.
Using robots.txt to control pagination should be treated as a last resort when implementing canonical tags is not possible.
Řízení konkrétního crawleru: User-agent: YandexBot Disallow: /
With the User-agent directive, you can set different rules for different crawlers. If you write User-agent: YandexBot and then Disallow: /, only YandexBot will be blocked from the entire site. Other crawlers will follow rules set under other User-agent sections, or the rules under User-agent: *.
Typical cases where you may want to control a specific crawler include the following.
When a specific crawler is placing excessive load on the server
When a specific crawler is ignoring robots.txt and causing problems
When you want to hide region-specific content from crawlers of search engines that are not used in that region
In these and similar cases, the User-agent directive is useful. The names of major search-engine crawlers can be confirmed in each search engine’s official documentation.
Kapitola 3: Upozornění a časté chyby v robots.txt

Robots.txt je silný nástroj, ale nesprávná nastavení mohou mít pro web vážné následky.
3.1 Poškození SEO chybami v robots.txt: vypadnutí z vyhledávání
Nejzávažnější chybou v robots.txt je neúmyslné zablokování důležitých stránek před procházením.
If you disallow product pages or service pages, for example, those pages may fall out of the search index and disappear from search results. That directly reduces website traffic and can severely harm SEO.
Při každé změně robots.txt použijte testovací nástroj v Google Search Console a ověřte, že jsou blokovány pouze zamýšlené stránky.
3.2 Chyba použití Allow pro stránky, které jste chtěli zablokovat
The Allow directive should be used only when you want to permit part of a location that has been blocked with Disallow. For example, if you want to block /private/ but allow only /private/public.html, you would use both Disallow: /private/ and Allow: /private/public.html.
Using Allow alone for an area that has not been disallowed has no effect. Crawlers generally assume every page is accessible unless it has been explicitly blocked with Disallow.
3.3 Rozlišování velikosti písmen: věnujte mu velkou pozornost
User-agent, Disallow, Allow, and URL paths are all case-sensitive. For example, disallow: /images/ is treated differently from Disallow: /images/ and will not work as intended.
When writing robots.txt, always use the correct capitalization and check carefully for typographical errors.
3.4 Rozdíly v chování crawlerů: práce se škodlivými crawlery
Robots.txt works with good-faith crawlers such as Googlebot and Bingbot, but malicious crawlers may ignore it completely. That means robots.txt alone cannot protect sensitive information.
Information that is truly confidential must be protected with server-side authentication or access restrictions. You need to understand that robots.txt is only a tool for controlling cooperative crawlers and is not sufficient as a security measure.
3.5 Robots.txt sám o sobě neposkytuje zabezpečení
As noted above, robots.txt is insufficient as a security measure. Anyone can read the contents of a robots.txt file, so malicious users may use it as a clue for finding restricted areas.
Real security requires a layered approach that combines multiple methods, including password protection, access control lists, and firewalls, not robots.txt alone.
3.6 Neočekávané chování při nadměrném používání zástupných znaků
Wildcards such as * and $ make path matching more flexible, but overusing them can block pages you never meant to block. For example, Disallow: /*image* would block not only the /images/ directory but also a URL such as /article/my-image.jpg.
When using wildcards, check the full scope of their effect carefully and make sure you are not blocking pages unintentionally.
3.7 Cache robots.txt: zpoždění před promítnutím změn
Search engines cache robots.txt, so changes are not always reflected immediately. Even if you check with a testing tool right after editing it, the result may still be based on the previous version.
In Google Search Console, you can request that robots.txt be fetched again through the robots.txt tester. This can shorten the delay before the cache updates and your changes are reflected.
Dodržováním těchto upozornění a správnou konfigurací robots.txt můžete zlepšit SEO a vyhnout se zbytečným rizikům.
Kapitola 4: Nástroje pro tvorbu robots.txt a metody ověření

Tato kapitola vysvětluje, jak robots.txt efektivně vytvářet, testovat a upravovat.
4.1 Použití nástrojů pro tvorbu robots.txt
You can write robots.txt manually, but online tools let you do it faster and with fewer mistakes. These tools generate a robots.txt file automatically once you input the necessary directives, which helps reduce syntax errors and rule mistakes.
Representative tools include the following.
Google Search Console robots.txt tester:
A built-in Search Console tool that can create, edit, and test robots.txt. If you already use Search Console, this is often the easiest choice.
SEO checker tools:
Some SEO tools include robots.txt generation features. Because they can be used together with other SEO functions, they are convenient when optimizing a site more broadly.
Other online robots.txt generators:
If you search the web for robots.txt generator, you will find many free tools. These are suitable for creating a simple robots.txt file.
Which tool is best depends on your needs and the size of the website.
4.2 Testování robots.txt v Google Search Console
Once you create robots.txt, you must test it to verify that crawlers interpret it correctly. Google Search Console provides a robots.txt testing tool that can show whether a specific URL is crawlable and whether there are mistakes in the file.
The testing process is as follows.
Open Google Search Console and select the property for the target website.
Choose the robots.txt tester from the menu on the left.
Enter the URL you want to test and click the Test button.
Review whether the URL is crawlable and which directive is being applied.
Whenever you change robots.txt, use this tool and confirm that the file works exactly as intended.
4.3 Kontrola a oprava robots.txt
Because robots.txt is placed in the root directory of a website, you can open it directly in a browser, review its contents, and revise it if necessary. For example, accessing https://example.com/robots.txt will display the file.
When making corrections, open robots.txt in a text editor, make the necessary changes, and upload it to the server. Because search engines need to refresh their cache, it may take a little time before the changes are reflected.
The robots.txt tester in Google Search Console lets you edit and test at the same time, making it easier to iterate on corrections and verification.
By following these steps, you can keep robots.txt in an optimal state and improve both SEO and site performance.
Kapitola 5: Řízení crawlerů nad rámec robots.txt

Rozdíly oproti meta robots tagu a jak je používat
Meta robots tag se používá k řízení crawlerů na úrovni jednotlivých stránek. Společně s robots.txt umožňuje jemnější kontrolu.
Použití společně s noindex a nofollow
You can specify multiple directives separated by commas, such as noindex,follow.
Řízení pomocí HTTP hlavičky X-Robots-Tag
By using X-Robots-Tag in the HTTP response header, you can control crawling for non-HTML files such as PDFs and images as well. This requires server-side configuration.
Shrnutí
Robots.txt je nepostradatelný nástroj pro SEO i výkon webu.
Když pochopíte body popsané v tomto článku a robots.txt správně nastavíte, můžete z webu dostat jeho plný potenciál.
Dodatek: příklady robots.txt včetně pokročilých
Allow only certain file types for a specific crawler:
User-agent: Googlebot-Image Allow: /images/*.jpg Allow: /images/*.png Disallow: / User-agent: * Disallow: /images/
Slow down access for a specific crawler:
User-agent: AhrefsBot Crawl-delay: 10 User-agent: * Allow: /
Use these advanced patterns to optimize your website and move it toward success.