In phpheader, pay attention to the 301404 redirection. 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. 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
The code is as follows: |
|
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
The code is as follows: |
|
Header ("HTTP/1.1 404 Not Found "); |
If the above does not work, try the following:
The code is as follows: |
|
Header ("Status: 404 Not Found "); |
So to be foolproof, you can write either of the following two sentences:
The code is as follows: |
|
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.
When checking header301 or 404, you must be careful and take a look at it ....