Robots.txt file: Difference between revisions
From Joomla! Documentation
No edit summary |
Marked this version for translation |
||
| (14 intermediate revisions by 7 users not shown) | |||
| Line 1: | Line 1: | ||
<noinclude><languages /></noinclude> | |||
<translate> | |||
Web | == About Robots == <!--T:1--> | ||
Web robots, also known as crawlers, web wanderers or spiders, are programs that traverse the web automatically. Among many uses, search engines use them to index the web content. | |||
<!--T:2--> | |||
The robots.txt file implements the [[wp:Robots exclusion standard|Robots Exclusion Protocol]] (REP), which allows the website administrator to define what parts of the site are off limits to specific robot user agents. Web administrators can Allow access to their web content and Disallow access to cgi, private and temporary directories, for example, if they do not want pages in those areas indexed. | |||
The robots.txt file | |||
== | == Where to Place the ''robots.txt'' File == <!--T:3--> | ||
A robots.txt file | A standard ''robots.txt'' file is included in your Joomla root. The ''robots.txt'' file must reside in the root of the domain or subdomain and must be named <code>robots.txt</code>. | ||
==Joomla robots.txt | === Joomla in a Subdirectory === <!--T:4--> | ||
A robots.txt file located in a subdirectory isn't valid. The bots only check for this file in the root of the domain. | |||
If the Joomla site is installed within a folder such as ''example.com/joomla/'', the ''robots.txt'' file '''must''' be moved to the site root at ''example.com/robots.txt''. | |||
< | <!--T:5--> | ||
Note: The Joomla folder name '''must''' be prefixed to the disallowed path. For example, the Disallow rule for the <code>/administrator/</code> folder '''must''' be changed to read <code>Disallow: /joomla/administrator/</code> | |||
== Joomla ''robots.txt'' Contents == <!--T:6--> | |||
This is the contents of a [https://github.com/joomla/joomla-cms/blob/4.2-dev/robots.txt.dist standard Joomla robots.txt]: | |||
<!--T:7--> | |||
<syntaxhighlight lang="text"> | |||
User-agent: * | User-agent: * | ||
Disallow: /administrator/ | Disallow: /administrator/ | ||
Disallow: /api/ | |||
Disallow: /bin/ | |||
Disallow: /cache/ | Disallow: /cache/ | ||
Disallow: /cli/ | Disallow: /cli/ | ||
Disallow: /components/ | Disallow: /components/ | ||
Disallow: /includes/ | Disallow: /includes/ | ||
Disallow: /installation/ | Disallow: /installation/ | ||
Disallow: /language/ | Disallow: /language/ | ||
Disallow: /layouts/ | |||
Disallow: /libraries/ | Disallow: /libraries/ | ||
Disallow: /logs/ | Disallow: /logs/ | ||
Disallow: /modules/ | Disallow: /modules/ | ||
Disallow: /plugins/ | Disallow: /plugins/ | ||
Disallow: /tmp/ | Disallow: /tmp/ | ||
</ | </syntaxhighlight> | ||
==Robot Exclusion== | == Robot Exclusion == <!--T:8--> | ||
You can exclude directories or block robots from your site adding Disallow rule to the robots.txt | You can exclude directories or block robots from your site by adding a Disallow rule to the ''robots.txt'' file. For example, to prevent any robots from visiting the ''/tmp'' directory, add this rule: | ||
<!--T:9--> | |||
<syntaxhighlight lang="text"> | |||
Disallow: /tmp/ | |||
</syntaxhighlight> | |||
<!--T:10--> | |||
See also: | |||
* [https:// | * [https://support.google.com/webmasters/topic/4598466?hl=en&ref_topic=9427949 Block access to your content] at Google's Help Center. | ||
=== | == Syntax Checking == <!--T:11--> | ||
* [https:// | For syntax checking you can use a validator for ''robots.txt'' files. Try one of these: | ||
* [https://support.google.com/webmasters/answer/6062598 Test your ''robots.txt'' with the robots.txt Tester] at Google. | |||
* [http://www.searchenginepromotionhelp.com/m/robots-text-tester/robots-checker.php ''robots.txt'' Checker] by Search Engine Promotion Help. | |||
[[Category:Search Engine | === General Information === <!--T:12--> | ||
* [http://www.robotstxt.org/ The Web Robots Pages] The main Website for ''robots.txt''. | |||
* [http://www.robotstxt.org/orig.html A Standard for Robot Exclusion] The original standard. | |||
* [https://developers.google.com/search/docs/advanced/robots/robots_meta_tag Robots meta tag, data-nosnippet, and X-Robots-Tag specifications] | |||
* [https://searchtools.com/robots/robots-txt.html Robots.txt and Search Indexing] | |||
</translate> | |||
[[Category:Search Engine Optimisation]] | |||
[[Category:Content Management]] | |||
Latest revision as of 11:59, 25 October 2022
About Robots
Web robots, also known as crawlers, web wanderers or spiders, are programs that traverse the web automatically. Among many uses, search engines use them to index the web content.
The robots.txt file implements the Robots Exclusion Protocol (REP), which allows the website administrator to define what parts of the site are off limits to specific robot user agents. Web administrators can Allow access to their web content and Disallow access to cgi, private and temporary directories, for example, if they do not want pages in those areas indexed.
Where to Place the robots.txt File
A standard robots.txt file is included in your Joomla root. The robots.txt file must reside in the root of the domain or subdomain and must be named robots.txt.
Joomla in a Subdirectory
A robots.txt file located in a subdirectory isn't valid. The bots only check for this file in the root of the domain. If the Joomla site is installed within a folder such as example.com/joomla/, the robots.txt file must be moved to the site root at example.com/robots.txt.
Note: The Joomla folder name must be prefixed to the disallowed path. For example, the Disallow rule for the /administrator/ folder must be changed to read Disallow: /joomla/administrator/
Joomla robots.txt Contents
This is the contents of a standard Joomla robots.txt:
User-agent: *
Disallow: /administrator/
Disallow: /api/
Disallow: /bin/
Disallow: /cache/
Disallow: /cli/
Disallow: /components/
Disallow: /includes/
Disallow: /installation/
Disallow: /language/
Disallow: /layouts/
Disallow: /libraries/
Disallow: /logs/
Disallow: /modules/
Disallow: /plugins/
Disallow: /tmp/
Robot Exclusion
You can exclude directories or block robots from your site by adding a Disallow rule to the robots.txt file. For example, to prevent any robots from visiting the /tmp directory, add this rule:
Disallow: /tmp/
See also:
- Block access to your content at Google's Help Center.
Syntax Checking
For syntax checking you can use a validator for robots.txt files. Try one of these:
- Test your robots.txt with the robots.txt Tester at Google.
- robots.txt Checker by Search Engine Promotion Help.
General Information
- The Web Robots Pages The main Website for robots.txt.
- A Standard for Robot Exclusion The original standard.
- Robots meta tag, data-nosnippet, and X-Robots-Tag specifications
- Robots.txt and Search Indexing