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
-agentGPTBot
Disallow
: /

User-agentAmazonbot
Disallow
: /

User-agentGooglebot
Disallow
: /

User-agentBingbot
Disallow
: /

User-agentAhrefsBot
Disallow
: /

User-agentDotBot
Disallow
: /

User-agentSemrushBot
Disallow
: /

User-agentMajestic-12
Disallow
: /

User-agentScreaming Frog SEO Spider
Disallow
: /

User-agentBaiduSpider
Disallow
: /

User-agentYandexBot
Disallow
: /

User-agentSogou
Disallow
: /

User-agentMJ12bot
Disallow
: /

User-agentPetalBot
Disallow
: /
EOL

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

    
# Block GPTBot
    
RewriteCond %{HTTP_USER_AGENTGPTBot [NC,OR]

    
# Block Amazonbot
    
RewriteCond %{HTTP_USER_AGENTAmazonbot [NC,OR]

    
# Block Googlebot
    
RewriteCond %{HTTP_USER_AGENTGooglebot [NC,OR]

    
# Block Bingbot
    
RewriteCond %{HTTP_USER_AGENTBingbot [NC,OR]

    
# Block AhrefsBot
    
RewriteCond %{HTTP_USER_AGENTAhrefsBot [NC,OR]

    
# Block DotBot
    
RewriteCond %{HTTP_USER_AGENTDotBot [NC,OR]

    
# Block SemrushBot
    
RewriteCond %{HTTP_USER_AGENTSemrushBot [NC,OR]

    
# Block Majestic-12 Bot
    
RewriteCond %{HTTP_USER_AGENTMJ12bot [NC,OR]

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

    
# Block BaiduSpider
    
RewriteCond %{HTTP_USER_AGENTBaiduSpider [NC,OR]

    
# Block YandexBot
    
RewriteCond %{HTTP_USER_AGENTYandexBot [NC,OR]

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

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

    
# Block PetalBot (Huawei)
    
RewriteCond %{HTTP_USER_AGENTPetalBot [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
  Anbindung eines Server an ein Bestehendes Grid Lindalou Ellisson 10 677 04.08.2024, 22:07
Letzter Beitrag: Jupiter Rowland
  Server-Tutorial: Linux und OpenSim Mareta Dagostino 39 80.931 11.05.2024, 23:11
Letzter Beitrag: Mareta Dagostino
  Opensim Server für jede Region separat starten Skimi 18 3.016 21.03.2024, 22:51
Letzter Beitrag: Manfred Aabye
  Freeswitch Server + Plugins Firestorm Freeswitch royalgrid 11 1.387 17.03.2024, 03:06
Letzter Beitrag: royalgrid
  Money Server - Classifieds Skimi 0 435 02.09.2023, 12:02
Letzter Beitrag: Skimi

Gehe zu:


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