Inline list of bad bots to block in .htaccess
This commit is contained in:
parent
346398e85a
commit
a4b7b723e7
|
@ -15,7 +15,5 @@ Header set Cache-Control "no-cache, public"
|
||||||
RewriteEngine on
|
RewriteEngine on
|
||||||
|
|
||||||
# Block bad bots
|
# Block bad bots
|
||||||
{% for bot in robots.htaccess -%}
|
RewriteCond %{HTTP_USER_AGENT} ({{ robots.htaccess }}) [NC]
|
||||||
RewriteCond %{HTTP_USER_AGENT} ({{ bot | replace(" ", ".*") }}) [NC{% if not loop.last %},OR{% endif %}]
|
|
||||||
{% endfor -%}
|
|
||||||
RewriteRule .* https://nocommercialuse.org/ [L]
|
RewriteRule .* https://nocommercialuse.org/ [L]
|
|
@ -23,10 +23,10 @@ export default async function () {
|
||||||
line !== "User-agent: Applebot"
|
line !== "User-agent: Applebot"
|
||||||
);
|
);
|
||||||
})
|
})
|
||||||
.map((line) => line.split(":")[1].trim());
|
.map((line) => line.split(":")[1].trim().replace(/\s/gi, ".*"));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
txt: txt,
|
txt: txt,
|
||||||
htaccess: bots,
|
htaccess: bots.join('|'),
|
||||||
};
|
};
|
||||||
}
|
}
|
Loading…
Reference in New Issue