Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Bots und Crawler auf Server Blocken
#3
Hier ist noch ein Bash Skript welches die Dateien auf einem Linux Server erstellt und die Rechte richtig setzt.

PHP-Code:
#!/bin/bash

# Verzeichnis setzen
DIRECTORY="/var/www/html"

# Datei robots.txt erstellen
cat <<EOL > $DIRECTORY/robots.txt
User
-agent: GPTBot
Disallow
: /

User-agent: Amazonbot
Disallow
: /

User-agent: Googlebot
Disallow
: /

User-agent: Bingbot
Disallow
: /

User-agent: AhrefsBot
Disallow
: /

User-agent: DotBot
Disallow
: /

User-agent: SemrushBot
Disallow
: /

User-agent: Majestic-12
Disallow
: /

User-agent: Screaming Frog SEO Spider
Disallow
: /

User-agent: BaiduSpider
Disallow
: /

User-agent: YandexBot
Disallow
: /

User-agent: Sogou
Disallow
: /

User-agent: MJ12bot
Disallow
: /

User-agent: PetalBot
Disallow
: /
EOL

# Datei .htaccess erstellen
cat <<EOL > $DIRECTORY/.htaccess
<IfModule mod_rewrite.c>
    
RewriteEngine On

    
# Block GPTBot
    
RewriteCond %{HTTP_USER_AGENT} GPTBot [NC,OR]

    
# Block Amazonbot
    
RewriteCond %{HTTP_USER_AGENT} Amazonbot [NC,OR]

    
# Block Googlebot
    
RewriteCond %{HTTP_USER_AGENT} Googlebot [NC,OR]

    
# Block Bingbot
    
RewriteCond %{HTTP_USER_AGENT} Bingbot [NC,OR]

    
# Block AhrefsBot
    
RewriteCond %{HTTP_USER_AGENT} AhrefsBot [NC,OR]

    
# Block DotBot
    
RewriteCond %{HTTP_USER_AGENT} DotBot [NC,OR]

    
# Block SemrushBot
    
RewriteCond %{HTTP_USER_AGENT} SemrushBot [NC,OR]

    
# Block Majestic-12 Bot
    
RewriteCond %{HTTP_USER_AGENT} MJ12bot [NC,OR]

    
# Block Screaming Frog SEO Spider
    
RewriteCond %{HTTP_USER_AGENT} Screaming Frog SEO Spider [NC,OR]

    
# Block BaiduSpider
    
RewriteCond %{HTTP_USER_AGENT} BaiduSpider [NC,OR]

    
# Block YandexBot
    
RewriteCond %{HTTP_USER_AGENT} YandexBot [NC,OR]

    
# Block Sogou Spider
    
RewriteCond %{HTTP_USER_AGENT} Sogou [NC,OR]

    
# Block MJ12bot (Majestic)
    
RewriteCond %{HTTP_USER_AGENT} MJ12bot [NC,OR]

    
# Block PetalBot (Huawei)
    
RewriteCond %{HTTP_USER_AGENT} PetalBot [NC]

    
# Deny access for these bots
    
RewriteRule .* - [F,L]
</
IfModule>
EOL

# Leserechte setzen
chmod 644 $DIRECTORY/robots.txt
chmod 644 $DIRECTORY
/.htaccess

echo "Die Dateien robots.txt und .htaccess wurden im Verzeichnis $DIRECTORY erstellt und die Leserechte wurden gesetzt." 
Ein Metaversum sind viele kleine Räume, die nahtlos aneinander passen,
sowie direkt sichtbar und begehbar sind, als wäre es aus einem Guss.



Zitieren


Nachrichten in diesem Thema
RE: Bots und Crawler auf Server Blocken - von Manfred Aabye - 17.09.2024, 17:50

Möglicherweise verwandte Themen…
Thema Verfasser Antworten Ansichten Letzter Beitrag
  Server-Tutorial: Linux und OpenSim Mareta Dagostino 62 124.577 05.04.2026, 11:12
Letzter Beitrag: Pius Noel
  OpenSim Currency Server 2025 Manfred Aabye 13 6.375 31.01.2026, 16:50
Letzter Beitrag: Manfred Aabye
  Freeswitch Server + Plugins Firestorm Freeswitch royalgrid 12 8.092 20.05.2025, 17:37
Letzter Beitrag: royalgrid
  Anbindung eines Server an ein Bestehendes Grid Lindalou Ellisson 10 5.558 04.08.2024, 22:07
Letzter Beitrag: Jupiter Rowland
  Opensim Server für jede Region separat starten Skimi 18 11.899 21.03.2024, 22:51
Letzter Beitrag: Manfred Aabye

Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste