Home » Blog » How to Automatically Block someone who is Snooping around your Site

How to Automatically Block someone who is Snooping around your Site

Security: Automatically block someone who is snooping around your site

In this article, we will expand on our PHP Ban script and show you how to automatically ban people attempting to snoop around your website.

For this article, you will need the PHP script mentioned in the other article here.

Now, create or edit the htaccess file located in the public_html folder and add the following to the bottom.

<FilesMatch 403.shtml>
Order Allow,Deny
Allow From All
</FilesMatch>
 
RewriteEngine On
 
## #######################! WARNING !########################## ##
## Make SURE you read the following rewrite rules to make sure  ##
## that none of them affect your actual site and to make sure   ##
## they are not blocking real, needed files or folders.         ##
## ############################################################ ##
 
## Keep the following for added security against snooping ##
RewriteRule ^phpmyadmin /block.php [NC]
RewriteRule ^README /block.php [NC]
 
## Unless you use your cgi-bin, keep the following ##
RewriteRule ^cgi-bin/formemail.cgi /block.php [NC]
RewriteRule ^cgi-bin /block.php [NC]
RewriteRule ^cgi-bin/(.*)$ /block.php [NC]
 
## Remove the following if you ARE using WordPress ##
RewriteRule ^wp-admin /block.php [NC]
RewriteRule ^wp-content /block.php [NC]
RewriteRule ^wp-includes /block.php [NC]
RewriteRule ^wp-config /block.php [NC]
RewriteRule ^wp-cron /block.php [NC]
 
## Remove the following if you ARE using Joomla ##
RewriteRule ^administrator /block.php [NC]
RewriteRule ^components /block.php [NC]
 
## Remove the following if you ARE using phpBB ##
RewriteRule ^adm /block.php [NC]
 
## Remove the following if you ARE using Magento ##
RewriteRule ^var /block.php [NC]
RewriteRule ^app /block.php [NC]
RewriteRule ^downloader /block.php [NC]
RewriteRule ^pkginfo /block.php [NC]
 
## Remove the following if you ARE using Moodle ##
RewriteRule ^auth /block.php [NC]
RewriteRule ^backup /block.php [NC]
RewriteRule ^grade /block.php [NC]
RewriteRule ^iplookup /block.php [NC]
RewriteRule ^message /block.php [NC]
RewriteRule ^mnet /block.php [NC]
RewriteRule ^plagiarism /block.php [NC]
RewriteRule ^webservices /block.php [NC]
 
############### START BANS ###############

With this change, and with the PHP script from the other article you will now be able to automatically ban people snooping around where they shouldn’t be. Make sure you review the htaccess file to make sure that no legitimate files are being blocked