Only allow the POST method for a specific file in a directory
- by Dave Chen
I have one file that should only be accessible via the POST method.
/var/www/folder/index.php
The document root is /var/www/ and index.php is nested inside a folder.
My configurations are as follows:
<Directory "/var/www/folder">
<Files "index.php">
order deny,allow
Allow from all
<LimitExcept POST>
Deny from all
</LimitExcept>
</Files>
</Directory>
I visit my server at 127.0.0.1/folder but I can GET and POST the file just like normal.
I've also tried reversing the order, order allow,deny, require, limitexcept and limit.
How can I only allow POST requests to be processed by one file in a folder?