的.htaccess 404重定向到PHP文件 [英] .htaccess 404 redirect to php file

查看:122
本文介绍了的.htaccess 404重定向到PHP文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

目前我正在试图创建一个重定向到一个PHP文件,如果一个错误发生404 .htaccess文件。

I am currently trying to create a .htaccess file that redirects to a php file if a error 404 occurred.

不过,当我选择一个PHP文件,它只是显示没有发现错误默认的404,但如果我改变它的HTML它,然后工作正常,并显示我的网页。

However, When I choose a php file it just displays the default 404 not found error, but if i change it to html it then works fine and displays my page.

什么是错。

感谢您的帮助

推荐答案

可悲的是没有足够的在这里继续下去,但我可以给你一些问题,以帮助您调试这个(太多的评论,否则我将不得不做到这一点):

Sadly there isn't enough to go on here, but I can give you some questions to help you debug this (too much for a comment otherwise I would have done that):

  • 如果您导航到它是通过Apache托管正确(当不被用作的ErrorDocument)的PHP文件?
  • 是否有从试图检索PHP文件作为错误文档在Apache日志中的错误?
  • 是默认404错误的一个来自Apache或您的浏览器吗?
  • 如果是Apache的它说有一个错误检索配置错误的文件?
  • 如果是从浏览器中的一个是php文件足够大,不会被浏览器OM NOM nommed(例如:的 512在IE 字节)
  • If you navigate to the php file is it hosted through Apache correctly (when not being used as an ErrorDocument)?
  • Are there errors in your apache logs from trying to retrieve the php file as an error document?
  • Is the "default" 404 error the one from Apache or your browser?
  • If it's Apache's does it say there was an error retrieving the configured error document?
  • If it's the one from your browser is the php file large enough to not be om nom nommed by the browser (for example: 512 bytes in IE )?

这篇关于的.htaccess 404重定向到PHP文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆