Redirects & rewrites

Add ordered path-based edge rules to redirect requests or rewrite them to a different internal path before they reach your app.

Where to configure it#

Open your app in the dashboard and go to App → Settings → Redirects & rewrites.

How rule matching works#

Rules are evaluated from top to bottom. The first matching rule wins. If no rule matches, Shiprr sends the request to your app unchanged.

  • Redirect — Changes the browser URL.
  • Rewrite — Keeps the browser URL the same.
  • Path-based only — Rules match paths on the current host.
  • No file-exists fallback — Rules apply by match order, not by checking whether a static file exists first.

Supported source patterns#

Rule sources and destinations must start with /. Shiprr supports three path pattern styles:

  • Exact path/documentation
  • Wildcard tail/app/*
  • Named segment/docs/:slug

Wildcards can only appear as the final segment. Named segments must occupy a full path segment.

Good and bad rules#

Good rules

  • /docs/documentation
  • /blog/:slug/articles/:slug
  • /app/*/index.html

Bad rules

  • docs because paths must start with /
  • /blog/*/edit because wildcards must be last
  • /docs/:slug.html because named segments must fill the full segment

Redirect status codes#

Redirect rules require an explicit status code.

  • 301 — Permanent redirect
  • 302 — Temporary redirect

The dashboard defaults new redirect rules to 302 so you can test behavior safely before switching a stable rule to 301.

Examples#

Move a page permanently#

type: redirect
source: /documentation
destination: /docs
status: 301

Requests to /documentation are redirected to /docs.

Preserve a named segment#

type: redirect
source: /blog/posts/:slug
destination: /blog/:slug
status: 302

A request to /blog/posts/hello-world becomes /blog/hello-world.

SPA fallback rewrite#

type: rewrite
source: /app/*
destination: /index.html

Requests like /app/settings keep the same browser URL, but Shiprr serves /index.html to your app.

Current limits#

Each app can have up to 50 rules. This keeps edge routing predictable while still leaving enough room for common app patterns.

Recommendations#

  • Put the most specific rules first.
  • Use 302 while testing and switch to 301 when final.
  • Use rewrites for SPA fallbacks, not redirects.
  • Keep your rule list short and readable even though the hard cap is 50.