php returns a 301 redirect method: 1. Normal temporary jump method in php, the code is [header("Location:your_dest_url")]; 2. Set the status code before to implement php 301 jump, code is [HTTP/1.1 301 Moved].
php method to return a 301 redirect:
1. Normal temporary jump in php Use:
header("Location:your_dest_url");
The returned status code is 302
2. If you want to implement php 301
jump, you need to set the status code before:
header( "HTTP/1.1 301 Moved Permanently" ) ; header("Location:your_dest_url");
Note: The difference between 30* return status codes
301, 302 are both HTTP status codes, and both represent that a certain URL has been transferred. The difference is :
301 redirect: 301 represents Permanently Moved,
php 301 redirection and make a permanent redirection of
url.
Copy after login
Related learning recommendations:
The above is the detailed content of How does php return a 301 redirect?. For more information, please follow other related articles on the PHP Chinese website!