的.htaccess 404重定向到PHP文件

编程入门 行业动态 更新时间:2024-10-27 22:30:49
本文介绍了的.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文件

本文发布于:2023-10-31 19:23:21,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1547046.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重定向   文件   htaccess   PHP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!