HTTP 301 status code
The requested resource has been permanently moved to a new location, and any future references to this resource should use one of several URIs returned in this response. If possible, clients with link editing capabilities should automatically modify the requested address to the address returned from the server. Unless otherwise specified, this response is also cacheable.
The new permanent URI should be returned in the Location field of the response. Unless this is a HEAD request, the response entity should contain a hyperlink to the new URI and a brief description.
If this is not a GET or HEAD request, the browser prohibits automatic redirection unless confirmed by the user, because the conditions of the request may change accordingly.
Note: For some browsers using the HTTP/1.0 protocol, when the POST request they send receives a 301 response, the subsequent redirect request will become a GET method.
Use php to implement 301:
<?php header("HTTP/1.1 301 Moved Permanently"); header("Location: http://www.xxx.com");
What is the difference between 302 and 301[Recommended reading: HTTP 302 status code]
301, 302 makes no difference to users. They see that the effect is just a jump, and the old URL in the browser becomes a new URL. The page jumps to where this new URL points. For engines and webmasters, 302 redirects may have problems with URL normalization and URL hijacking. It may be judged as suspicious redirection by search engines, or even considered as cheating.