[英]htaccess deny access to file if no $_POST exist?
Is it possible to deny access to a file if there is no $_POST to the file? 如果文件中没有$ _POST,是否可以拒绝对该文件的访问?
what i have here: 我在这里有什么:
<Files *.php>
Order Deny,Allow
Deny from all
Allow from 127.0.0.1
</Files>
<Files index.php>
Order Allow,Deny
Allow from all
</Files>
Here the File is blocked all the time. 这里文件一直被阻止。
You may use mod_rewrite to achieve this: 您可以使用mod_rewrite实现此目的:
RewriteEngine on
RewriteCond %{REQUEST_METHOD} !POST [NC]
RewriteRule .*\.php / [F,L]
This will respond with a HTTP status 403 to all requests to PHP files that aren't sent as POST. 这将以HTTP状态403响应未通过POST发送的对PHP文件的所有请求。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.