To block a bot using .htaccess, follow the steps below:

  • Log in to cPanel
  • Go to File Manager
  • At the top right, at Settings, click the button and select "Show Hidden Files (dotfiles)"
  • Edit the .htaccess file and add the code sequence below:
ErrorDocument 503 "Site temporarily disabled for crawling"
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^.*(bot|crawl|spider).*$ [NC]
RewriteCond %{REQUEST_URI} !^/robots\.txt$
RewriteRule .* - [R=503,L]
  • Save the .htaccess file
Cette réponse était-elle pertinente ? 0 Utilisateurs l'ont trouvée utile (0 Votes)