TestingAPIs is still being built. If something breaks, email support@testingapis.com.

Redirects to a local path on this server

GETPOSTPUTPATCHDELETEHEADhttps://api.testingapis.com/api/redirect/toSign in to see this endpoint's URL

Accepts GET, POST, PUT, PATCH, DELETE and HEAD.

Parameters 2

NameTypeDescription
urlquery · stringTarget path. It must start with a single / (e.g. /api/echo?x=1) and be at most 2048 characters. Absolute URLs, //host, /\host and control characters are rejected to prevent open redirects.
statusquery · integer (int32)Redirect status: 301, 302, 303, 307 or 308. Default 302. Default: 302.

Responses

200
OK
302
Or the chosen redirect status, with Location set to url.
400
Missing or non-local url, or unsupported status.

Example

Request
curl -X GET "https://api.testingapis.com/api/redirect/to?url=/api/echo&status=302" \
  -H "X-TestingApis-Key: YOUR_API_KEY"
Response302 Found
Location: /api/echo

{
  "status": 302,
  "statusText": "Found",
  "location": "/api/echo",
  "remaining": null,
  "keepsMethod": false
}

Sign in to see the details

The parameters, request and response examples and the live Try it panel for this endpoint are for signed-in members. Accounts are free and take a few seconds to create.