|
Disallow: / User-agent: Googlebot Allow: / Note that the robots.txt file can contain as many user agent directives as you like. That said, every time you declare a new user agent, it works as a clean slate. This means that if you add directives to multiple user agents, directives declared for the first user agent will not apply to the second, third, fourth, etc. The exception to this rule is when declaring the same user agent multiple times. In that case, all related directives are combined and executed. Important notes Crawlers follow only the most precisely applicable rules declared in the user agent . Therefore, the robots.txt file above will block all bots except Googlebot (and other Google bots) from crawling your site.
Googlebot ignores less specific user agent declarations. Directives Directives are rules that you want the declared user Australia Phone Number Data agent to follow. Supported directives Here are the directives that Google currently supports and their uses. Disallow Use this directive to tell search engines not to visit files or pages belonging to a specific path. For example, if you want to prevent all search engines from accessing your blog and all of its posts, your robots.txt file might look like this: User-agent: * Disallow: /blog Note : If you don't define a path after the disallow directive, search engines will ignore it. Allow This directive allows search engines to crawl subdirectories or pages (even within directories where they are normally not allowed).
For example, if you want to prevent search engines from accessing all posts on your blog except for one page, your robots.txt file might look like this: User-agent: * Disallow: /blog Allow: /blog/allowed-post In this example, search engines /blog/allowed-postcan access. However, you cannot access the following: /blog/another-post /blog/yet-another-post /blog/download-me.pdf Both Google and Bing support this directive. Note : Similar to the Disallow directive, if you do not define a path after the Allow directive, search engines will ignore it. Notes on conflicting rules If not written carefully, Disallow and Allow directives can easily conflict with each other. The following example /blog/ prohibits access to and /blog allows access to .
|
|