dongtiao0279 2012-07-20 20:44
浏览 93
已采纳

使用htaccess允许POST,但阻止浏览PHP文件

I have a directory with PHP files I do not want anonymous users to view or bots to index. However, I do want anonymous HTTP POST request-resposes to the PHP files to work (i.e. from other PHP forms on various websites).

Will it be this?

<Limit POST GET>
allow from all
</Limit>
<files "*.php">
deny from all
</files>

My PHP script processes posted data and then performs a POST to another web-service. Will the .htaccess block post-response communications from the protected PHP script?

  • 写回答

2条回答 默认 最新

  • dsyua2828 2012-07-20 20:55
    关注

    You don't need to do anything. PHP can't be viewed from outside. At all. The only way to see PHP code is to somehow gain access to the computer on which it is held: this is because PHP is parsed and executed by the server to generate the HTML which is shown to the client. In other words, as long as someone has not hacked into your actual server computer, they can't see your PHP.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥60 用visual studio编写程序,利用间接平差求解水准网
  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?
  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案