Last modified by superadmin on 2026/11/25 21:35

Show last authors
1 1. Write the rules below into a ##robots.txt##. The patterns use ##*## rather than ##/bin/## so that they also match a path-based subwiki such as ##/xwiki/wiki/myalias/view/Space/Page##.(((
2 {{code language="none"}}
3 User-agent: *
4 # Prevent bots from executing all actions except "view" since:
5 # 1) we don't want bots to execute stuff in the wiki!
6 # 2) we don't want bots to consume CPU and memory
7 # (for example to perform exports)
8 # Attached images are allowed below, before /download/ is disallowed.
9 Allow: /xwiki/*/download/*.png$
10 Allow: /xwiki/*/download/*.jpg$
11 Allow: /xwiki/*/download/*.jpeg$
12 Allow: /xwiki/*/download/*.gif$
13 Disallow: /xwiki/*/viewattachrev/
14 Disallow: /xwiki/*/viewrev/
15 Disallow: /xwiki/*/pdf/
16 Disallow: /xwiki/*/tex/
17 Disallow: /xwiki/*/edit/
18 Disallow: /xwiki/*/create/
19 Disallow: /xwiki/*/inline/
20 Disallow: /xwiki/*/preview/
21 Disallow: /xwiki/*/save/
22 Disallow: /xwiki/*/saveandcontinue/
23 Disallow: /xwiki/*/rollback/
24 Disallow: /xwiki/*/deleteversions/
25 Disallow: /xwiki/*/cancel/
26 Disallow: /xwiki/*/delete/
27 Disallow: /xwiki/*/deletespace/
28 Disallow: /xwiki/*/undelete/
29 Disallow: /xwiki/*/reset/
30 Disallow: /xwiki/*/register/
31 Disallow: /xwiki/*/propupdate/
32 Disallow: /xwiki/*/propadd/
33 Disallow: /xwiki/*/propdisable/
34 Disallow: /xwiki/*/propenable/
35 Disallow: /xwiki/*/propdelete/
36 Disallow: /xwiki/*/objectadd/
37 Disallow: /xwiki/*/commentadd/
38 Disallow: /xwiki/*/commentsave/
39 Disallow: /xwiki/*/objectsync/
40 Disallow: /xwiki/*/objectremove/
41 Disallow: /xwiki/*/attach/
42 Disallow: /xwiki/*/upload/
43 Disallow: /xwiki/*/download/
44 Disallow: /xwiki/*/temp/
45 Disallow: /xwiki/*/downloadrev/
46 Disallow: /xwiki/*/dot/
47 Disallow: /xwiki/*/svg/
48 Disallow: /xwiki/*/delattachment/
49 Disallow: /xwiki/*/login/
50 Disallow: /xwiki/*/loginsubmit/
51 Disallow: /xwiki/*/loginerror/
52 Disallow: /xwiki/*/logout/
53 Disallow: /xwiki/*/charting/
54 Disallow: /xwiki/*/lock/
55 Disallow: /xwiki/*/redirect/
56 Disallow: /xwiki/*/admin/
57 Disallow: /xwiki/*/export/
58 Disallow: /xwiki/*/import/
59 Disallow: /xwiki/*/get/
60 Disallow: /xwiki/*/distribution/
61 Disallow: /xwiki/*/imagecaptcha/
62 Disallow: /xwiki/*/unknown/
63 # Don't index sample content.
64 Disallow: /xwiki/*/view/Sandbox/
65 # The Admin space is protected by rights anyway; this is a safety net.
66 Disallow: /xwiki/*/view/Admin/
67 # Statistics pages are not useful and are CPU intensive.
68 Disallow: /xwiki/*/view/Stats/
69 # Panels are UI, not content.
70 Disallow: /xwiki/*/view/Panels/
71 # The search page.
72 Disallow: /xwiki/*/Main/Search
73 # The REST API.
74 Disallow: /xwiki/rest/
75 # UI elements that send crawlers into infinite loops (XWIKI-16915).
76 Disallow: /xwiki/*?*xpage=*
77 {{/code}}
78 )))
79 1. Serve the file from the **root of the host**, which is the only place a crawler reads it: the document root of the web server in front of XWiki, or the ##ROOT## web application of the Servlet Container when it answers directly. A ##robots.txt## inside ##/xwiki/## is never read.
80 1. Give each host its own file. A wiki farm answering on several domains, and a subwiki on a domain of its own, each serve their own ##robots.txt##.
81 1. Request the file and check that the rules are the ones the crawler will see.(((
82 {{code language="bash"}}
83 curl https://wiki.example.com/robots.txt
84 {{/code}}
85 )))

Get Connected