Block bots
This commit is contained in:
parent
90fc60e871
commit
6cdd20eedc
6 changed files with 110 additions and 2 deletions
|
|
@ -3,6 +3,7 @@ import tailwindIntegration from "@astrojs/tailwind";
|
|||
import markdownIntegration from "@astropub/md";
|
||||
import htaccessIntegration from "astro-htaccess";
|
||||
import pagefindIntegration from "astro-pagefind";
|
||||
import { AI_BOTS } from "./src/data/ai_bots";
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
|
|
@ -14,6 +15,15 @@ export default defineConfig({
|
|||
markdownIntegration(),
|
||||
htaccessIntegration({
|
||||
generateHtaccessFile: import.meta.env.APACHE_CONFIG === "true",
|
||||
customRules: [
|
||||
// Block AI bots
|
||||
"<IfModule mod_rewrite.c>",
|
||||
" RewriteEngine on",
|
||||
" RewriteBase /",
|
||||
` RewriteCond %{HTTP_USER_AGENT} ${AI_BOTS.map((bot) => `^${bot}$`).join("|")} [NC]`,
|
||||
" RewriteRule ^ – [F]",
|
||||
"</IfModule>",
|
||||
],
|
||||
redirects: [
|
||||
{ match: "/story/", url: "/stories/" },
|
||||
{ match: "/game/", url: "/games/" },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue