… und die üblen Bots halten sich nicht an solche Vorgaben. Eine Lösung ist es erst, wenn man solchen Bots keinen Download anbietet, z. B.:
PHP-Code:
<?php
$userAgent = $_SERVER['HTTP_USER_AGENT'];
$badBots = array(
'Majestic12',
'adscanner',
'seoscanners',
);
foreach ($badBots as &$value) {
if (preg_match("/\b$value\b/", $userAgent))
{
$blockBot = true;
}
}
?>
<?php if ($blockBot != true): ?>
<?php $this->extend('block_searchable'); ?>
<?php $this->block('content'); ?>
<ul>
<?php foreach ($this->files as $file): ?>
<li class="download-element ext-<?= $file['extension'] ?>">
<?php if ($file['previews']): ?>
<?php foreach ($file['previews'] as $preview): ?>
<?php $this->insert('image', $preview->getLegacyTemplateData()) ?>
<?php endforeach ?>
<?php endif ?>
<a href="<?= $file['href'] ?>" rel="nofollow" title="<?= $file['title'] ?>" type="<?= $file['mime'] ?>"><?= $file['link'] ?> <span class="size">(<?= $file['filesize'] ?>)</span></a>
</li>
<?php endforeach; ?>
</ul>
<?php $this->endblock(); ?>
<?php endif ?>
Eine Liste übler Bots findet man hier:
https://github.com/mitchellkrogza/ng...er-agents.list
Lesezeichen