Erreur32 revisó este gist 3 months ago. Ir a la revisión
Sin cambios
Erreur32 revisó este gist 3 months ago. Ir a la revisión
1 file changed, 38 insertions
blocage_bot_apache.md(archivo creado)
| @@ -0,0 +1,38 @@ | |||
| 1 | + | RewriteEngine On | |
| 2 | + | ||
| 3 | + | # Exclude ACME challenge | |
| 4 | + | RewriteCond %{REQUEST_URI} ^/\.well-known/acme-challenge | |
| 5 | + | RewriteRule ^ - [L] | |
| 6 | + | ||
| 7 | + | # Whitelist your IP | |
| 8 | + | RewriteCond %{REMOTE_ADDR} ^XX\.XXX\.XX\.XXX$ | |
| 9 | + | RewriteRule .* - [L] | |
| 10 | + | ||
| 11 | + | # Allow known bots | |
| 12 | + | RewriteCond %{HTTP_USER_AGENT} (Baiduspider|Polyring) [NC] | |
| 13 | + | RewriteRule .* - [L] | |
| 14 | + | ||
| 15 | + | # Allow access to errors folder | |
| 16 | + | RewriteCond %{REQUEST_URI} ^/errors/ | |
| 17 | + | RewriteRule .* - [L] | |
| 18 | + | ||
| 19 | + | # Allow access to specific RSS feeds | |
| 20 | + | RewriteCond %{REQUEST_URI} ^/feeds/blog\.php$ [OR] | |
| 21 | + | RewriteCond %{REQUEST_URI} ^/feeds/combined\.php$ [OR] | |
| 22 | + | RewriteCond %{REQUEST_URI} ^/social/rss/index\.php$ [OR] | |
| 23 | + | RewriteCond %{REQUEST_URI} ^/rss\.php$ [OR] | |
| 24 | + | RewriteCond %{REQUEST_URI} ^/robots\.txt$ [OR] | |
| 25 | + | RewriteCond %{REQUEST_URI} ^/public/feeds/feed\.opml$ | |
| 26 | + | RewriteRule .* - [L] | |
| 27 | + | ||
| 28 | + | # Block common scraping libraries | |
| 29 | + | RewriteCond %{HTTP_USER_AGENT} (python|okhttp|libwww|Go-http-client|Apache-HttpClient|curl) [NC] | |
| 30 | + | RewriteRule .* - [F,L] | |
| 31 | + | ||
| 32 | + | # Block unidentified bots: empty UA or Accept | |
| 33 | + | RewriteCond %{HTTP_USER_AGENT} ^$ [OR] | |
| 34 | + | RewriteCond %{HTTP_ACCEPT} ^$ | |
| 35 | + | RewriteRule .* - [F,L] | |
| 36 | + | ||
| 37 | + | # Inline 403 message for humans | |
| 38 | + | ErrorDocument 403 /errors/403.txt | |
Siguiente
Anterior