I'm wanting to block POST requests to a specific URL on a website. Here is an example of a spammy POST request from my Apache log:
110.86.178.xxx - - [14/Jan/2015:17:05:05 +0000] "POST /profile/example/trackback/ HTTP/1.1" 200 85 "http://example.com/profile/example/" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) )"
I added the following code to the .htaccess file:
# deny POST requests
<IfModule mod_rewrite.c>
RewriteCond %{REQUEST_METHOD} POST
RewriteRule /profile/example/trackback/ [F,L]
</IfModule>
Unfortunately I'm still receiving trackback emails, so it's not working.
What is the issue and how can I fix this? Also, how could I amend the code to block all POST requests sent to urls ending in /trackback/
Thanks!
You can use this rule in root .htaccess:
RewriteEngine On
RewriteCond %{REQUEST_METHOD} POST
RewriteRule (^|/)trackback/?$ - [F,NC]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With