一剑飞虹

道可道非常道,名可名非常名
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

apache ci 的404设置

Posted on 2012-08-28 10:20  greatqn  阅读(866)  评论(0编辑  收藏  举报

服务器异常信息,越少泄露越好。为避免一些探测url的异常,我们需要定制404页。

1.apache

httpd.conf里:对<Directory />一节中,增加:

    ErrorDocument 404 /404.html
    ErrorDocument 403 /404.html

原始文件:

把 error/HTTP_NOT_FOUND.html.var下的HTTP_NOT_FOUND.html.var改成你想要的页就可以了
要是改路径就在httpd.conf中设 ErrorDocument 404  /

 2.ci默认

默认404页面在 application\errors 目录下。

3.routes.php 设置

$route['404_override'] = 'Index/error_404';

这里会把一些controller层的异常url,跳转到指定的controller上。

4.目录

在目录下放置index.html页面。禁止文件目录浏览。

#开启目录列表索引模式
Options Indexes

禁用:Options -Indexes

4.监控apache

<Location /ancun_server-status>
  SetHandler server-status
  Order deny,allow
  Deny from all
  Allow from 127.0.0.1
</Location>