Subscribe to PHP Freaks RSS

308 Permanent Redirect

syndicated from planet-php.net on November 6, 2018

308 Permanent Redirect is similar to 301 Moved Permanently. Both indicate that the resource the user tried to access has moved to a new location. In both cases the client should update any bookmarks they had from the old to the new location. Search engines respect these statuses too.



The difference between 301 and 308 is that a client that sees a 308 redirect MUST do the exact same request on the target location. If the request was a POST and and had a body, then the client must do a POST request with a body on the new location.



In the case of 301 a client may do this. In practice, most clients don’t do this and convert the POST request to a GET request.



The 308 is relatively new, and is currently marked as experimental in RFC7238. Most modern clients support it, but you might run into some issues with older clients.



Example



HTTP/1.1 308 Permanent Redirect
Location: https://evertpot.com/http/308-permanent-redirect
Server: Apache/2.4.29


References



  • RFC7238 - Status Code 308 (Permanent Redirect).