SIP
Simular respuesta 301 Moved Permanently
The user can no longer be found at the address in the Request-URI. The client should direct future requests to the new address in the Contact header.
Ver referencia completa →1 Respuesta HTTP
HTTP/1.1 301 Moved Permanently Content-Type: application/json Date: Tue, 25 Feb 2026 12:00:00 GMT Location: https://example.com/new-location
2 Probar con curl
curl -i https://httpbin.org/status/301
3 Devolver 301 Moved Permanently en tu framework
django
from django.http import HttpResponse
def my_view(request):
return HttpResponse(status=301) # Moved Permanently
flask
from flask import Flask
app = Flask(__name__)
@app.route("/endpoint")
def my_endpoint():
return "", 301 # Moved Permanently
fastapi
from fastapi import FastAPI
from fastapi.responses import Response
app = FastAPI()
@app.get("/endpoint")
def my_endpoint():
return Response(status_code=301) # Moved Permanently
express.js
// Express.js
app.get('/endpoint', (req, res) => {
res.sendStatus(301); // Moved Permanently
});
spring boot
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
@RestController
public class MyController {
@GetMapping("/endpoint")
public ResponseEntity<Void> myEndpoint() {
return ResponseEntity
.status(301) // Moved Permanently
.build();
}
}
go net/http
package main
import "net/http"
func myHandler(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(301) // Moved Permanently
}
ruby on rails
class MyController < ApplicationController
def my_action
head :moved_permanently
end
end
asp.net core
// ASP.NET Core Minimal API
app.MapGet("/endpoint", () =>
Results.StatusCode(301) // Moved Permanently
);