Use for loop to generate rewrite conditions for commercial AI bots
This commit is contained in:
parent
3d1d3d4da4
commit
0030302d64
|
@ -14,5 +14,7 @@ Header set Cache-Control "no-cache, public"
|
|||
RewriteEngine on
|
||||
|
||||
# Block bad bots
|
||||
RewriteCond %{HTTP_USER_AGENT} {{ robots.htaccess }} [NC]
|
||||
{% for bot in robots.htaccess -%}
|
||||
RewriteCond %{HTTP_USER_AGENT} ({{ bot }}) [NC{% if not loop.last %},OR{% endif %}]
|
||||
{% endfor -%}
|
||||
RewriteRule .* https://nocommercialuse.org/ [L]
|
|
@ -27,6 +27,6 @@ export default async function () {
|
|||
|
||||
return {
|
||||
txt: txt,
|
||||
htaccess: bots.join("|"),
|
||||
htaccess: bots,
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue