How To Restrict Bots From Accessing Your WordPress Site?

A bot is an application that is automated and runs script over the internet. They can perform tasks faster and can do repetitive tasks at a much higher rate than human. Bots can make your life easier and sometimes it can be a nuisance. In WordPress, bots can be used to breach the security of databases, login portal, hosts, etc. Therefore it is recommended to harden your WordPress site and restrict bots from accessing your site.

Step::1 Login to your cPanel and click File manager.

Step::2 Go inside public_html directory where you will find the .htaccess

Step::3 Now, we need to restrict bots by adding some codes to the .htaccess file. Right click on .htaccess file and choose the Edit option.

Add the following lines of code to your .htaccess file to restrict bots from your site

#Block Bad User Agents 
RewriteEngine On
RewriteCond %{HTTP_USER_AGENT} ^SpiderMan[OR] 
RewriteCond %{HTTP_USER_AGENT} ^voyager[OR] 
RewriteCond %{HTTP_USER_AGENT} ^WaveFire 
RewriteRule .* - [F,L]

 

(In the above code, SpiderMan, voyager and Wavefire are the bots. These can be replaced by the bots you want to block.)

The last line of code requests the server to give a 403 error to the bots in the code.

Step::4 You can also restrict the access if you know the IP address of the bot.

You can list the IP addresses in the .htaccess file
You can add the IP address or the range of IP address of the bot that you want to block.

#Restrict IP of bots 
Deny from 123.123.45.184 
Deny from 123.123.99.952 
#Restrict IP range of bots 
Deny from 123.123.123.0/24


Step::5 Finally click on Save Changes tab and Close the Editor.

By following the steps mentioned, you can make your site safe from malicious bots to access your site.

Visit the Blog for more details. You can also watch the video here

  • How To Restrict Bots From Accessing Your WordPress Site, how to secure your site and restrict bots from accessing your Wo, wordpress tutorials, wordpress
  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

How to Fix WordPress error “There has been a critical error on your website”

Step::1 First of all login to your cPanel and go to File ManagerStep::2 Go inside public_html and...

How to Stay Logged in for a longer period in your WordPress?

Step::1 First of all you must know the theme which is currently activated in your website. So...

How to bulk delete spam comments in your WordPress website?

Step::1 Login to your cPanel and click on File Manager sectionStep::2 Go to public_html and then...

How to Change WordPress logo in wp-admin page?

Step::1 Login to your cPanel and go to File Manager sectionStep::2 Now go to Public_html Step::3...

How to Change WordPress Admin Username?

Step::1 Login to your WordPress dashboardStep::2 Now at the same time login to your WordPress...