How to limit access to POST request over HTTPS for a single a file in Apache?
I have limited access to a file service.php
located in /var/www/sample
to HTTPS with following code:
<Directory /var/www/sample>
<Files service.php>
SSLRequireSSL
</Files>
</Directory>
Now, I would like to limit the 开发者_如何学Pythonaccess only for POST requests. There is a <Limit>
directive that should do this but how should I combine it with the above configuration?
you could use mod_rewrite and add this code:
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/service.php # if service.php requested
RewriteCond %{REQUEST_METHOD} !^POST$ [NC] # and if its not post
RewriteRule .* - [F] # then block access (403 forbidden)
精彩评论