> ## Documentation Index
> Fetch the complete documentation index at: https://docs.base44.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Update URL redirect

> <Info>This API is in beta. Endpoints, fields, and behavior may still change, so avoid depending on it in production.</Info>

Replaces a redirect's source, target and match type.

Send the whole rule: every field is applied, not merged, and the same rules as [Create URL redirect](/api-reference/create-url-redirect) apply. If the new rule conflicts with another one the redirect is left exactly as it was.

<Warning>Send `match_type` every time. It defaults to `single`, so leaving it out of an update to a `prefix` rule quietly narrows the rule to its own path and every child path stops redirecting.</Warning>

Changing `source_path` tries to drop the cached copy of both the old and the new path. As on [Create URL redirect](/api-reference/create-url-redirect) that is best effort and unreported: an old source whose cache survives can keep serving the previous target's page, with a 200, until the cache revalidates or expires.

Both paths start with `/`, are at most 512 characters, and carry no query string or fragment; Base44 strips a trailing slash and decodes percent-escapes before storing them, so `/old/` and `/%6Fld` are the same rule. `target_path` may instead be an absolute `https://` URL to send visitors to another site.

A rule is rejected when its source is a reserved path the redirect layer never sees (`/sitemap.xml`, `/robots.txt`, `/favicon.ico`, `/manifest.json`, `/link_preview.png`, `/llms.txt`, `/.well-known/*`, and the app's auth paths), when source and target are equal, when a `prefix` rule starts at `/`, and when it overlaps another rule or would make a visitor follow two redirects in a row. Overlap is resolved against the whole rule set, so a `prefix` rule at `/docs` blocks a `single` rule at `/docs/intro`, and an internal target that matches any other rule's source is a chain.

<Warning>The response includes fields beyond the ones documented here. Don't rely on undocumented response fields, as they can change at any time.</Warning>

<Note>This endpoint accepts a personal API key. Workspace API keys are not authorized for it and are rejected with a 403.</Note>



## OpenAPI

````yaml /developers/references/app-management/app-management-openapi.json put /api/apps/{app_id}/url-redirects/{redirect_id}
openapi: 3.1.0
info:
  title: Base44 App Management API
  version: 1.0.0
servers:
  - url: https://app.base44.com
security:
  - ApiKeyAuth: []
paths:
  /api/apps/{app_id}/url-redirects/{redirect_id}:
    put:
      summary: Update URL redirect
      description: >-
        <Info>This API is in beta. Endpoints, fields, and behavior may still
        change, so avoid depending on it in production.</Info>


        Replaces a redirect's source, target and match type.


        Send the whole rule: every field is applied, not merged, and the same
        rules as [Create URL redirect](/api-reference/create-url-redirect)
        apply. If the new rule conflicts with another one the redirect is left
        exactly as it was.


        <Warning>Send `match_type` every time. It defaults to `single`, so
        leaving it out of an update to a `prefix` rule quietly narrows the rule
        to its own path and every child path stops redirecting.</Warning>


        Changing `source_path` tries to drop the cached copy of both the old and
        the new path. As on [Create URL
        redirect](/api-reference/create-url-redirect) that is best effort and
        unreported: an old source whose cache survives can keep serving the
        previous target's page, with a 200, until the cache revalidates or
        expires.


        Both paths start with `/`, are at most 512 characters, and carry no
        query string or fragment; Base44 strips a trailing slash and decodes
        percent-escapes before storing them, so `/old/` and `/%6Fld` are the
        same rule. `target_path` may instead be an absolute `https://` URL to
        send visitors to another site.


        A rule is rejected when its source is a reserved path the redirect layer
        never sees (`/sitemap.xml`, `/robots.txt`, `/favicon.ico`,
        `/manifest.json`, `/link_preview.png`, `/llms.txt`, `/.well-known/*`,
        and the app's auth paths), when source and target are equal, when a
        `prefix` rule starts at `/`, and when it overlaps another rule or would
        make a visitor follow two redirects in a row. Overlap is resolved
        against the whole rule set, so a `prefix` rule at `/docs` blocks a
        `single` rule at `/docs/intro`, and an internal target that matches any
        other rule's source is a chain.


        <Warning>The response includes fields beyond the ones documented here.
        Don't rely on undocumented response fields, as they can change at any
        time.</Warning>


        <Note>This endpoint accepts a personal API key. Workspace API keys are
        not authorized for it and are rejected with a 403.</Note>
      operationId: update_url_redirect_api_apps__app_id__url_redirects__redirect_id__put
      parameters:
        - name: app_id
          in: path
          required: true
          schema:
            type: string
            description: ID of the app whose URL redirects to manage.
            title: App Id
          description: ID of the app whose URL redirects to manage.
          example: 6820f3a4e7b91d003c45a1f2
        - name: redirect_id
          in: path
          required: true
          schema:
            type: string
            description: >-
              ID of the redirect, as returned in `id` by [List URL
              redirects](/api-reference/list-url-redirects).
            title: Redirect Id
          description: >-
            ID of the redirect, as returned in `id` by [List URL
            redirects](/api-reference/list-url-redirects).
          example: 68c2d1e5f3b8a4216e9b5583
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UrlRedirectPayload'
      responses:
        '200':
          description: The updated redirect.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UrlRedirectResource'
        '401':
          description: Missing or invalid credentials.
        '402':
          description: Your workspace plan doesn't include custom domains.
        '403':
          description: >-
            You don't have access to this app, or you used a workspace API key.
            These endpoints take a personal API key.
        '404':
          description: The app has no URL redirect with this ID.
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    UrlRedirectPayload:
      properties:
        source_path:
          type: string
          maxLength: 512
          minLength: 1
          title: Source Path
          description: >-
            Path visitors request, starting with `/`. Base44 strips a trailing
            slash and decodes percent-escapes before storing it, so `/old/` and
            `/%6Fld` are the same rule.
          example: /old-pricing
        target_path:
          type: string
          maxLength: 512
          minLength: 1
          title: Target Path
          description: >-
            Where to send them: an internal path starting with `/`, or an
            absolute `https://` URL on another site. Store it without a query
            string or fragment; the visitor's own query string is carried over
            to the destination, so `/old?utm=x` lands on `/new?utm=x`.
          example: /pricing
        match_type:
          $ref: '#/components/schemas/UrlRedirectMatchType'
          description: >-
            `single` redirects that exact path. `prefix` redirects it and
            everything under it, keeping the remainder of the path. Defaults to
            `single`, so omitting it on an update turns an existing `prefix`
            rule into a `single` one and its child paths stop redirecting.
          default: single
          example: single
      additionalProperties: false
      type: object
      required:
        - source_path
        - target_path
      title: UrlRedirectPayload
    UrlRedirectResource:
      properties:
        id:
          type: string
          title: Id
          description: >-
            ID of the redirect. Pass it as `redirect_id` to [Update URL
            redirect](/api-reference/update-url-redirect) and [Delete URL
            redirect](/api-reference/delete-url-redirect).
          example: 68c2d1e5f3b8a4216e9b5583
        source_path:
          type: string
          title: Source Path
          description: >-
            The path visitors request, normalized: no trailing slash,
            percent-escapes decoded.
          example: /old-pricing
        target_path:
          type: string
          title: Target Path
          description: >-
            Where the visitor is sent. Either an internal path or an absolute
            `https://` URL on another site.
          example: /pricing
        match_type:
          $ref: '#/components/schemas/UrlRedirectMatchType'
          description: >-
            `single` redirects that exact path. `prefix` redirects the path and
            everything under it, keeping the remainder of the path.
          example: single
      type: object
      required:
        - id
        - source_path
        - target_path
        - match_type
      title: UrlRedirectResource
      description: One 301 redirect rule on the app's published site.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    UrlRedirectMatchType:
      type: string
      enum:
        - single
        - prefix
      title: UrlRedirectMatchType
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api_key
      description: Personal API key.

````