Repository navigation
Expand file tree
/
Copy pathrobots.php
More file actions
64 lines (57 loc) · 1.59 KB
/
Copy pathrobots.php
File metadata and controls
64 lines (57 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**
* robots.txt for OpenParliamentTV (served via a rewrite so the Sitemap URL and
* host are derived from config across the different parliament subdomains).
*
* Policy:
* - Search engines (Googlebot, Bingbot, Applebot, …) may crawl everything
* except admin/auth/utility paths.
* - /api/ is intentionally crawlable (the sanctioned machine-readable path);
* raw JSON is kept out of the index via an X-Robots-Tag: noindex header.
* - A curated list of AI-training / scraping bots is disallowed entirely.
* (Server-level 403 enforcement for the same list lives in .htaccess.)
*/
require_once(__DIR__ . '/config.php');
header('Content-Type: text/plain; charset=utf-8');
header('Cache-Control: public, max-age=86400');
$baseUrl = rtrim($config["dir"]["root"], '/');
// AI / scraper user-agents to block. Keep in sync with the .htaccess 403 list.
$blockedBots = [
'GPTBot',
'OAI-SearchBot',
'ChatGPT-User',
'ClaudeBot',
'anthropic-ai',
'Claude-Web',
'Google-Extended',
'Applebot-Extended',
'PerplexityBot',
'CCBot',
'cohere-ai',
'Bytespider',
'Amazonbot',
'Meta-ExternalAgent',
'FacebookBot',
'Diffbot',
'ImagesiftBot',
'Omgilibot',
'YouBot',
'DataForSeoBot',
'PetalBot',
];
?>
User-agent: *
Allow: /
Disallow: /manage/
Disallow: /login
Disallow: /register
Disallow: /registerConfirm
Disallow: /password-reset
Disallow: /logout
Disallow: /embed/
Disallow: /notifications
<?php foreach ($blockedBots as $bot): ?>
User-agent: <?= $bot ?>
<?php endforeach; ?>
Disallow: /
Sitemap: <?= $baseUrl ?>/sitemap.xml