308Permanent Redirect
Similar to 301, but explicitly keeps the same HTTP method for the redirection.
What this code obliges you to do
Safe to retry
Repeating the same request can succeed, so a client may back off and try again. Honour Retry-After when the response sends one.
Cacheable by default
RFC 9110 lists this code as heuristically cacheable, so a cache may store it even with no Cache-Control header. Send explicit headers if that is not what you want.
Body allowed
You may return a payload explaining the outcome — for an error, a machine-readable problem document is worth the effort.
Method and body preserved
The client must repeat the original method and body against the new URL. This is the code to use when redirecting a POST.
Target replaces the old URL
A permanent redirect tells search engines to move the URL and carry its ranking signals across. Use it for migrations you are not undoing.
When you see it
1Permanent API endpoint moves
Effect on search
Passes link equity exactly like 301. Preferred for modern RESTful API URL structure changes.
How to send it
1http.Redirect(w, r, newURL, http.StatusPermanentRedirect)