dsb238100 2016-05-31 10:02
浏览 422

Apache Web Server - 如何返回404错误而不是403

I am currently working with an apache .htaccess file. My previous directories were configured to return 403 error. I am now suppose to return 404 error instead of 403(for security purposes). Having no clue of how to do it, I simply replaced all the 403 to 404 in the configuration This is where I arrived to my problem. Out of 50 directories, only a few of them did not change.

For example, These are the few that did not change:

www.example.com/icons/

www.example.com/icons/small/

www.example.com/cgi-bin/

www.example.com/~ftp/

I tried looking up online, did research and try and error for hours. I've tried things like ErrorDocument 404, adding RedirectMatch 404 to the configuration in htaccess and nothing worked for me. Any advice or little form of help? Thank you very much for replying in advance! Any would be appreciated.

  • 写回答

1条回答 默认 最新

  • dongruo4601 2016-05-31 10:32
    关注

    You can rewrite your 403 error requests to 404 page using this :

    ErrorDocument 403 /404.php
    

    Or redirect to new url 404.php

    RedirectMatch 403 ^/404.php
    
    评论

报告相同问题?

悬赏问题

  • ¥15 微信小程序协议怎么写
  • ¥15 c语言怎么用printf(“\b \b”)与getch()实现黑框里写入与删除?
  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看