donglanche9257 2014-09-05 19:17
浏览 45

too long

I want to prevent general access to my css files so I want to know if there is a way to redirect the browser if the user tries to access /graphics/style/*.css using .htaccess since one can't put a redirect rule in a css file?? the css file would be written on page load, and deleted on session end but i need to prevent the css file from being viewed during a session.

Is it possible to do allow access only from server??

  • 写回答

1条回答 默认 最新

  • dongzilu0178 2014-09-05 19:22
    关注

    In your .htaccess file and add this line:

    Deny from  all
    

    if you are planning to restrict to the complete folder create a htaccess in that folder and update above line, and it won't be accessible.

    For redirect you can use:

     Redirect /folder/ 404.html
    

    Edit: you can allow only server access the content by allowing the server ip to access the content and deny from others:

     order deny,allow
     deny from all
     allow from 111.222.333.444
    

    Refer:

    Deny all, allow only one IP through htaccess

    deny direct access to a folder and file by htaccess

    Deny access to one specific folder in .htaccess

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题