17.09.2024, 17:50
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.
http://zainhofer.de/
sowie direkt sichtbar und begehbar sind, als wäre es aus einem Guss.
http://zainhofer.de/

