windows, linux system 404 setup tutorial (applicable to virtual hosting)
Published: 2014-12-24
Setting up a good custom error page can increase the website's indexing and retain some customers who might give up because a page cannot be opened. Our company's virtual hosting specifically provides custom error page settings, and all custom errors, including 404 errors, can be configured.
Linux system setup method:
Step 1: Create a text file locally and add the following statement in the text:
ErrorDocument 404 /404.html
Then upload it to wwwroot and rename it to .htaccess. If the website directory already has this file, download it, open it with an editor, and add the above rule.
Step 2: Upload your own 404 prompt file and rename it to 404.html. You can also use other extensions, as long as the same file is specified in .htaccess, for example ErrorDocument 404 /404.php
Note: The pseudo-static rules built into some programs will conflict with 404. If this happens, you can only contact the program provider to debug the pseudo-static rules.
Windows system setup method:
First, open our company's website, enter the username and password to log in to the Management Center, click "Business Management" -- "Virtual Host Management" on the left, then select your virtual host on the right and click "Manage"
In the virtual host management panel, click "Error Page Definition" to enter the custom error settings.

In "Error Page Definition", click "Set Custom Error". The system will generate an HttpErrors directory under your wwwroot directory and copy all error pages to this directory. You only need to download the corresponding page, modify it, and upload it again.

The Windows 2003 system 404 prompt page path is the file wwwroot/HttpErrors/404b.htm. You only need to modify the file 404b.htm to the prompt content you want. The Windows 2008 system 404 file name is wwwroot/HttpErrors/404.htm
Note: The "Set Custom Error" function returns status code 200. If you need to return a 404 status code, please use the following methods:
1. Click "Set Dynamic 404 Page" and specify your own designed 404 static page, such as 404.html. The returned status code will be 404.
2. If the 404 page is dynamic, such as 404.php or 404.asp, you need to add the corresponding status code to the header of these dynamic web pages:
For ASP, add: <%Response.Status="404 Moved Permanently"%>
For PHP, add: <?php header("HTTP/1.0 404 Not Found")?>
Then in "Set Dynamic 404 Page", specify the dynamic 404 page.
Appendix:URL status code online check tool
