dsolwotv00116 2017-04-17 04:36
浏览 85
已采纳

如何保护public_html中的文件夹免受访问者的侵害

I need to keep all my files and folders of my website in public_html folder. There are some folders for javascript codes like 'Javascript' and css codes like 'CSS', 'Images' for images, etc. It is easy for any visitor to type just the folder address like 'http://www.website.com/Javascript' and he will have permission to see all my javascript codes. I want to restrict these folders from visitors and use only for my scripts which are uploaded in public_html folder. How can this be done? Please give solution for my scripts in public_html also, which will need to access those folders.

  • 写回答

1条回答 默认 最新

  • drh96824 2017-04-17 04:54
    关注

    For your security purpose you can set access permission for the public access for particular files, folder etc with the apache .htaccess file.

    In your case create .htaccess file in the folder name public_html and put the bellow htaccess configuration:

    Completely restricted from web server.

    Deny from all
    

    Restrict folder, sever can access files.

    Options -Indexes
    

    This works for me.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 iOS绕地区网络检测
  • ¥15 python验证码滑块图像识别
  • ¥15 根据背景及设计要求撰写设计报告
  • ¥15 QT6颜色选择对话框显示不完整
  • ¥20 能提供一下思路或者代码吗
  • ¥15 用twincat控制!
  • ¥15 请问一下这个运行结果是怎么来的
  • ¥15 单通道放大电路的工作原理
  • ¥30 YOLO检测微调结果p为1
  • ¥15 DS18B20内部ADC模数转换器