Home > Backend Development > PHP Tutorial > 404 - header('http/1.1 404 not found'); Why not jump? (PHP)

404 - header('http/1.1 404 not found'); Why not jump? (PHP)

WBOY
Release: 2016-08-04 09:20:05
Original
2030 people have browsed it

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>
Copy after login
Copy after login

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!

Reply content:

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>
Copy after login
Copy after login

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

Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template