Only allow the POST method for a specific file in a directory
        Posted  
        
            by 
                Dave Chen
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by Dave Chen
        
        
        
        Published on 2013-10-11T02:55:56Z
        Indexed on 
            2013/10/17
            21:59 UTC
        
        
        Read the original article
        Hit count: 318
        
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?
© Server Fault or respective owner