Specification of the HTTP status code 301
The 301 Moved Permanently status code indicates that the target resource has been assigned a new permanent URI and any future references to this resource ought to use one of the enclosed URIs. Clients with link-editing capabilities ought to automatically re-link references to the effective request URI to one or more of the new references sent by the server, where possible.
The server SHOULD generate a Location header field in the response containing a preferred URI reference for the new permanent URI. The user agent MAY use the Location field value for automatic redirection. The server's response payload usually contains a short hypertext note with a hyperlink to the new URI(s).
Note: For historical reasons, a user agent MAY change the request method from POST to GET for the subsequent request. If this behavior is undesired, the 307 (Temporary Redirect) status code can be used instead.
A 301 Moved Permanently response is cacheable by default; i.e., unless otherwise indicated by the method definition or explicit cache controls (see Section 4.2.2 of [RFC7234]).
Source / Quote by: The 301 Moved Permanently HTTP Status Code is specified by section 6.4.2 of RFC7231.
How to throw a 301 statuscode with PHP?
Test the 301 HTTP status code
In order to be able to display the HTTP status code (in this case 301 Moved Permanently) and other information on the client side, the development console must be opened with F12. Afterwards you have to navigate to the tab "Network". Now you can open the page, in the network tab you should see the web page (example index.php). This must be selected and then the Herder section must be selected. Here the user will see the following result:
Browser compatibility of the 301 status code
|Firefox for Android||Yes|
|Safari on iOS||Yes|