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
|
RewriteEngine on
|
||||||
|
|
||||||
# Block bad bots
|
# 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]
|
RewriteRule .* https://nocommercialuse.org/ [L]
|
|
@ -27,6 +27,6 @@ export default async function () {
|
||||||
|
|
||||||
return {
|
return {
|
||||||
txt: txt,
|
txt: txt,
|
||||||
htaccess: bots.join("|"),
|
htaccess: bots,
|
||||||
};
|
};
|
||||||
}
|
}
|
Loading…
Reference in New Issue