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
|
||||
|
||||
# Block bad bots
|
||||
{% for bot in robots.htaccess -%}
|
||||
RewriteCond %{HTTP_USER_AGENT} ({{ bot | replace(" ", ".*") }}) [NC{% if not loop.last %},OR{% endif %}]
|
||||
{% endfor -%}
|
||||
RewriteCond %{HTTP_USER_AGENT} ({{ robots.htaccess }}) [NC]
|
||||
RewriteRule .* https://nocommercialuse.org/ [L]
|
|
@ -23,10 +23,10 @@ export default async function () {
|
|||
line !== "User-agent: Applebot"
|
||||
);
|
||||
})
|
||||
.map((line) => line.split(":")[1].trim());
|
||||
.map((line) => line.split(":")[1].trim().replace(/\s/gi, ".*"));
|
||||
|
||||
return {
|
||||
txt: txt,
|
||||
htaccess: bots,
|
||||
htaccess: bots.join('|'),
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue