zoukankan      html  css  js  c++  java
  • ThinkPHP访问不存在的模块跳到404页面

    在ACTION中新建一个文件EmptyAction.class.php,文件中的代码如下:

    <?php
    class EmptyAction extends Action{
        function _empty(){
            header("HTTP/1.0 404 Not Found");//使HTTP返回404状态码
            $this->display("Public:404");
        }
    }
    ?>

    在apache中设置

    在你的网站配置中加入 ErrorDocument 404 /404.html 即可。


    在iis中设置

    IIS/ASP.net下设置404错误页面

    打开apache httpd.conf配置文件或者新建.htaccess配置文件


    首先,修改应用程序根目录的设置,打开 “web.config” 文件编辑,在其中加入如下内容:

    <configuration>
     <system.web>
     <customErrors mode=”On” defaultRedirect=”error.asp”>
     <error statusCode=”404″ redirect=”notfound.asp” />
     </customErrors>
     </system.web>
     </configuration>
     

    注:上文例中“error.asp”为系统默认的404页面,“notfound.asp”为自定义的404页面,使用时请修改相应文件名。 
    然后,在自定义的404页面“notfound.asp”中加入:

    <%
     Response.Status = “404 Not Found”
     %>
     

    php 404

     if(如果没有任何结果)
         {
         //以前是仅仅显示“该帖子已经不存在”的提示,现在是:
         require(’/404.php’);
         @header(’HTTP/1.1 404 Not Found’);
         @header(’Status: 404 Not Found’);
         exit;
         }
     

  • 相关阅读:
    设计模式4---策略模式
    设计模式3---抽象工厂模式
    209. Minimum Size Subarray Sum(双指针)
    174. Dungeon Game(动态规划)
    二分查找
    74. Search a 2D Matrix(二分查找,剑指offer 1)
    81. Search in Rotated Sorted Array II
    33. Search in Rotated Sorted Array(二分查找)
    34. Search for a Range (二分查找)
    35. Search Insert Position(二分查找)
  • 原文地址:https://www.cnblogs.com/chinalorin/p/5884222.html
Copyright © 2011-2022 走看看