HTTP 301 Moved Permanently is the standard way to tell clients and search engines that a resource has permanently moved to a new URL. The client SHOULD use the new URL for all future requests. Search engines transfer link equity (PageRank) to the new URL, making 301 the primary tool for URL migration, domain changes, and site restructuring. Critically, many browsers change POST to GET on 301 redirects — if method preservation matters, use 308 instead.
Response includes the status code, standard headers (including Content-Type), and a small diagnostic JSON body describing the request and returned status.
Simulator URL (copy in the app after load — not a normal link):
https://httpstatus.com/api/status/301
Example request:
curl -i "https://httpstatus.com/api/status/301"The URL of the requested resource has been changed permanently.
On this code, Inspector focuses on semantics, headers, and correctness warnings that commonly affect clients and caches.
301 Moved Permanently (RFC 7231 Section 6.4.2) requires the server to include a Location header with the new URI. Historical behavior: despite the spec allowing the redirect to preserve the method, virtually all browsers and HTTP clients convert POST/PUT to GET when following a 301. This is why 308 Permanent Redirect was created. SEO impact: Google treats 301 as a signal to transfer PageRank to the new URL, typically within days. Chain multiple 301s and you lose small amounts of equity at each hop. Caching: 301 responses are cacheable by default — browsers remember the redirect. Set Cache-Control: no-cache if the redirect might change.
app.get('/old-path', (req, res) => {
res.redirect(301, '/new-path');
});from fastapi.responses import RedirectResponse
@app.get('/old-path')
async def old_path():
return RedirectResponse('/new-path', status_code=301)@GetMapping("/old-path")
public ResponseEntity<Void> oldPath() {
return ResponseEntity.status(301)
.header("Location", "/new-path")
.build();
}func oldPathHandler(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/new-path", 301)
}