zoukankan      html  css  js  c++  java
  • 禁止浏览.htaccess文件

    很多黑客会攻击和利用.htaccess做网站跳转,所以保护好.htaccess文件尤为重要。

    在apache的httpd.conf的配置文件中 默认是已经设置了禁止对.htaccess的访问,截取相关配置文件如下:

    # The following lines prevent .htaccess and .htpasswd files from being
    # viewed by Web clients.
    #
    <FilesMatch "^.ht">
    Order allow,deny
    Deny from all
    Satisfy All
    </FilesMatch>

    我通过:http://localhost/test/.htaccess,在本地默认访问我的.htacess文件出现:

    Forbidden

    You don't have permission to access /test/.htaccess on this server.

    当然当apache没设这样的配置或者自己没权限更改配置文件时,你也可以手动在更改自己本地的.htacess文件,添加如下代码:

    <Files .htaccess>
    order allow,deny
    deny from all
    </Files>

    这样的效果和上面一样。

    当把deny改成allow,代码改成如下:

    <Files .htaccess>
    order allow,deny
    allow from all
    </Files>

    我们的.htacess文件即可以被访问,当然这样是比较危险的,我们本地只是做个测试。还是赶快把allow改成deny吧。

  • 相关阅读:
    js闭包
    python切片 []取值操作符
    python with语句
    python鸭子类型(duck type)
    python编码规范
    python @property使用详解
    python __slots__使用详解
    Python面向对象编程
    ifconfig命令详解
    5、Cocos2dx 3.0游戏开发找小三之測试例子简单介绍及小结
  • 原文地址:https://www.cnblogs.com/psz1992/p/4444595.html
Copyright © 2011-2022 走看看