If your webpage shows 301 or 404, it is a very serious problem for the user experience, so we must be careful when doing phpheader301 or 404. let's take a look at it. 301 jump header (#39; HTTP... if your webpage shows 301 or 404, it is a very serious problem for the user experience, so we must be careful when doing php header301 or 404, let me take a look.
301 jump
Header ('http/1.1 301 Moved Permanently '); header ('Location: http://www.abc.com/aaa/'); exit ();
Do not miss the header ('http/1.1 301 Moved Permanently '); otherwise, no 301 is returned.
404 error page
Header ("HTTP/1.1 404 Not Found ");
If the above does not work, try the following:
Header ("Status: 404 Not Found ");
So to be foolproof, you can write either of the following two sentences:
Header ("HTTP/1.1 404 Not Found"); header ("Status: 404 Not Found ");
Tips,
After writing the code, we must use the webmaster tool to test whether the returned status is what we want.