Only allow the POST method for a specific file in a directory
You could use the Require
directive:
<Directory "/var/www/folder">
<Files "index.php">
Require method POST
</Files>
</Directory>
However, since that's part of the authorization section, you may want to try this instead:
<Directory "/var/www/folder">
<Files "index.php">
<LimitExcept POST>
Order allow,deny
Deny from all
</LimitExcept>
</Files>
</Directory>
If your apache config tricks don't work, you could do it in the index.php itself. At the top of the file add something like thisthis:
<?php
if($_SERVER['REQUEST_METHOD'] != "POST") {
header("HTTP/1.0 403 Forbidden");
print("Forbidden");
exit();
}