Block pointless POST requests

Share Button

Not sure why, but spam bots love to make pointless POST requests against random pages on your websites, probably trying to find vulnerable php apps, SQL injections, etc.  If you have a website, or at least directories on a website, where these requests are pointless; i.e. static content there would never be a valid POST request sent to, you can block them so it doesn’t waste your bandwidth.  Here’s the code you’d use in a .htaccess file:

RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteRule .* - [F]

You could also limit it to more specific parts of the site if needed, such as only denying post requests against /

RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteCond %{REQUEST_URI} ^/$
RewriteRule .* - [F]
Share Button

Leave a Reply

Your email address will not be published. Required fields are marked *