我正在使用linux box和php。我安排了很多cron任务。如果某人直接尝试使用浏览器访问这些文件,我想阻止访问这些文件。我该怎么做。
答案 0 :(得分:3)
答案 1 :(得分:1)
使用 .htaccess 的示例解决方案:
<Files "cronjobs.php">
Order deny,allow
Allow from allowedmachine.com
Allow from localhost
Deny from all
</Files>
答案 2 :(得分:0)
也许这个? [来源]:https://github.com/h5bp/html5-boilerplate/blob/master/.htaccess
# "-Indexes" will have Apache block users from browsing folders without a
# default document Usually you should leave this activated, because you
# shouldn't allow everybody to surf through every folder on your server (which
# includes rather private places like CMS system folders).
<IfModule mod_autoindex.c>
Options -Indexes
</IfModule>