Home Backend Development PHP Tutorial ThinkPHP accesses non-existent modules and jumps to the 404 page_PHP tutorial

ThinkPHP accesses non-existent modules and jumps to the 404 page_PHP tutorial

Jul 20, 2016 am 11:11 AM
404 page thinkphp one time introduce about exist us module access

Let’s introduce how ThinkPHP accesses non-existent modules and jumps to the 404 page. Friends in need can refer to it.

Create a new file EmptyAction.class.php in ACTION. The code in the file is as follows:

Open the apache httpd.conf configuration file or create a new .htaccess configuration file
The code is as follows
 代码如下 复制代码

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

Copy code

class EmptyAction extends Action{

function _empty(){
header("HTTP/1.0 404 Not Found"); // Make HTTP return 404 status code

$this->display("Public:404");

}

}

? >


 代码如下 复制代码







Set in apache


and add ErrorDocument 404 /404.html to your website configuration.

 代码如下 复制代码

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

Set in iis

Set 404 error page under IIS/ASP.net
 代码如下 复制代码

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


First, modify the settings of the application root directory, open the "web.config" file for editing, and add the following content to it:
The code is as follows

Copy code
Note: "error.asp" in the above example is the system's default 404 page , "notfound.asp" is a customized 404 page, please modify the corresponding file name when using it. Then, add in the customized 404 page "notfound.asp":
The code is as follows
Copy code
<%<🎜>Response.Status = “404 Not Found”<🎜>%> php 404
The code is as follows Copy code
if (if there are no results) { //Previously it only displayed "This post no longer exists" "The prompt is now: require('/404.php'); @header('HTTP/1.1 404 Not Found'); @header('Status: 404 Not Found') ; exit; } http://www.bkjia.com/PHPjc/444652.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/444652.htmlTechArticle Let’s introduce how ThinkPHP can access non-existent modules and jump to the 404 page. Friends in need can refer to it. Create a new file EmptyAction.class.php in ACTION. The code in the file...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

WLAN expansion module has stopped [fix] WLAN expansion module has stopped [fix] Feb 19, 2024 pm 02:18 PM

If there is a problem with the WLAN expansion module on your Windows computer, it may cause you to be disconnected from the Internet. This situation is often frustrating, but fortunately, this article provides some simple suggestions that can help you solve this problem and get your wireless connection working properly again. Fix WLAN Extensibility Module Has Stopped If the WLAN Extensibility Module has stopped working on your Windows computer, follow these suggestions to fix it: Run the Network and Internet Troubleshooter to disable and re-enable wireless network connections Restart the WLAN Autoconfiguration Service Modify Power Options Modify Advanced Power Settings Reinstall Network Adapter Driver Run Some Network Commands Now, let’s look at it in detail

WLAN extensibility module cannot start WLAN extensibility module cannot start Feb 19, 2024 pm 05:09 PM

This article details methods to resolve event ID10000, which indicates that the Wireless LAN expansion module cannot start. This error may appear in the event log of Windows 11/10 PC. The WLAN extensibility module is a component of Windows that allows independent hardware vendors (IHVs) and independent software vendors (ISVs) to provide users with customized wireless network features and functionality. It extends the capabilities of native Windows network components by adding Windows default functionality. The WLAN extensibility module is started as part of initialization when the operating system loads network components. If the Wireless LAN Expansion Module encounters a problem and cannot start, you may see an error message in the event viewer log.

Detailed introduction to what wapi is Detailed introduction to what wapi is Jan 07, 2024 pm 09:14 PM

Users may have seen the term wapi when using the Internet, but for some people they definitely don’t know what wapi is. The following is a detailed introduction to help those who don’t know to understand. What is wapi: Answer: wapi is the infrastructure for wireless LAN authentication and confidentiality. This is like functions such as infrared and Bluetooth, which are generally covered near places such as office buildings. Basically they are owned by a small department, so the scope of this function is only a few kilometers. Related introduction to wapi: 1. Wapi is a transmission protocol in wireless LAN. 2. This technology can avoid the problems of narrow-band communication and enable better communication. 3. Only one code is needed to transmit the signal

How to run thinkphp project How to run thinkphp project Apr 09, 2024 pm 05:33 PM

To run the ThinkPHP project, you need to: install Composer; use Composer to create the project; enter the project directory and execute php bin/console serve; visit http://localhost:8000 to view the welcome page.

Detailed explanation of whether win11 can run PUBG game Detailed explanation of whether win11 can run PUBG game Jan 06, 2024 pm 07:17 PM

Pubg, also known as PlayerUnknown's Battlegrounds, is a very classic shooting battle royale game that has attracted a lot of players since its popularity in 2016. After the recent launch of win11 system, many players want to play it on win11. Let's follow the editor to see if win11 can play pubg. Can win11 play pubg? Answer: Win11 can play pubg. 1. At the beginning of win11, because win11 needed to enable tpm, many players were banned from pubg. 2. However, based on player feedback, Blue Hole has solved this problem, and now you can play pubg normally in win11. 3. If you meet a pub

There are several versions of thinkphp There are several versions of thinkphp Apr 09, 2024 pm 06:09 PM

ThinkPHP has multiple versions designed for different PHP versions. Major versions include 3.2, 5.0, 5.1, and 6.0, while minor versions are used to fix bugs and provide new features. The latest stable version is ThinkPHP 6.0.16. When choosing a version, consider the PHP version, feature requirements, and community support. It is recommended to use the latest stable version for best performance and support.

How to run thinkphp How to run thinkphp Apr 09, 2024 pm 05:39 PM

Steps to run ThinkPHP Framework locally: Download and unzip ThinkPHP Framework to a local directory. Create a virtual host (optional) pointing to the ThinkPHP root directory. Configure database connection parameters. Start the web server. Initialize the ThinkPHP application. Access the ThinkPHP application URL and run it.

Which one is better, laravel or thinkphp? Which one is better, laravel or thinkphp? Apr 09, 2024 pm 03:18 PM

Performance comparison of Laravel and ThinkPHP frameworks: ThinkPHP generally performs better than Laravel, focusing on optimization and caching. Laravel performs well, but for complex applications, ThinkPHP may be a better fit.

See all articles