Home > Article > Backend Development > 404 - header('http/1.1 404 not found'); Why not jump? (PHP)
As far as I know, add the following sentence to the .htaccess or apache config file: ErrorDocument 404 /missing.html
(Note: I have created this file)
Then, when we enter a url that does not exist, This missing.html page will appear.
Then I tried it again and wrote the following code in test.php:
<code><?php header('HTTP/1.1 404 Not Found'); ?> </code>
Found that the missing.html page will not be displayed.
Then I want to ask, how to display it?
Or maybe I am wrong in writing this? Why?
In fact, what is the use of header('HTTP/1.1 404 Not Found');
?
New to PHP, I hope you guys can give me some advice, thank you!
As far as I know, add the following sentence to the .htaccess or apache config file: ErrorDocument 404 /missing.html
(Note: I have created this file)
Then, when we enter a url that does not exist, This missing.html page will appear.
Then I tried it again and wrote the following code in test.php:
<code><?php header('HTTP/1.1 404 Not Found'); ?> </code>
Found that the missing.html page will not be displayed.
Then I want to ask, how to display it?
Or maybe I am wrong in writing this? Why?
In fact, what is the use of header('HTTP/1.1 404 Not Found');
?
New to PHP, I hope you guys can give me some advice, thank you!
HTTP status code: http://baike.sogou.com/v78674...
The ErrorDocument in the Apache configuration uses a page to display the corresponding error status information, not a jump. Please use 302,301 or JS, HTML meta refresh for jump
web server configuration