Sta*_*ers 6 php security .htaccess
如果我的问题不清楚,我会道歉,但我不太喜欢这个行话.通过'资源目录'我的意思是我的CSS,PHP脚本,图像,JavaScript等.
我在我的images目录中使用了一个.htaccess文件
deny from all
Run Code Online (Sandbox Code Playgroud)
去做这个.虽然这阻止了人们在浏览器中输入"www.example.com/images"并访问我的图像目录,但图像停止出现在我的网站上.
我认为这是因为.htaccess文件甚至拒绝我的源代码访问图像.如何让我的源代码访问目录?我每晚都有一个运行php脚本的cron作业.还需要允许cron作业访问scripts目录.
另外,使用.htaccess文件甚至是保护网站的最佳方式?
Ivo*_*eek 13
要阻止某人查看您的图像目录,您需要禁止Directory Listing.
http://viralpatel.net/blogs/htaccess-directory-listing-enable-disable-allow-deny-prevent-htaccess-directory-listing/
您无法使用deny from all,因为无法从Web浏览器从该目录加载任何内容,因此您在网站上加载的图像也不会加载.
Options -Indexes将禁止人们列出图像目录中的文件.请参阅http://viralpatel.net/blogs/htaccess-directory-listing-enable-disable-allow-deny-prevent-htaccess-directory-listing/
为了保护数据不会被不应该使用身份验证的人查看.您可以使用htaccess或脚本1设置登录字段,例如PHP或python.
使用htaccess登录脚本:脚本:http: //www.htaccesstools.com/htpasswd-generator/ 密码文件:http: //www.htaccesstools.com/htaccess-authentication/
| 归档时间: |
|
| 查看次数: |
15552 次 |
| 最近记录: |