duanhunlou7051 2013-06-05 09:12
浏览 68

不存在的文件未被重定向到我的自定义404页面。 在本地服务器上正常工作

The below is my .htaccess file placed in the root

ErrorDocument 404 http://www.abc.com/404.php Redirect /services/something.php http://www.abc.com/index.php

The second line is irrelevant I guess.

The problem is that it redirects any non existent file to my 404.php perfectly when I run it in my local WAMP server. But with the same is not happening when I upload it to my server. What could be wrong?

Also, if I write

ErrorDocument 404 /404.php instead of ErrorDocument 404 http://www.abc.com/404.php it won't even work in the localhost.

I get the error message saying

The requested URL /abc/xxxx was not found on this server. Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request. Why does this error occur when every website I refer has recommended ErrorDocument 404 /404.php

  • 写回答

1条回答 默认 最新

  • douzhui1972 2013-06-05 09:55
    关注

    first of all make sure that the 404.php is present in the proper location and http://www.abc.com/404.php is working properly.

    if both 404.php and .htaccess are present in the same root folder, then try changing following line in .htaccess file

    ErrorDocument 404 /404.php 
    

    to

    ErrorDocument 404 /root/404.php 
    
    评论

报告相同问题?

悬赏问题

  • ¥15 微信会员卡接入微信支付商户号收款
  • ¥15 如何获取烟草零售终端数据
  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?