Free auditStart free
GuideAstro · URL migrations

Astro redirects

Configure Astro redirects for static and SSR sites, preserve route parameters, and verify that your host returns the intended HTTP status.

3 min
read
3
sources
Oct 24, 2026
updated
Scaplet Editorial Team
author
In one line

Add redirect mappings in astro.config.mjs for known route moves, then confirm how your deployment serves them. A static Astro build without a redirect-capable adapter outputs a meta refresh HTML page, which does not return an HTTP 301. SSR or a compatible static adapter can issue real redirect status codes. Remove route collisions and test the deployed response, destination, and query behavior.

30-second check

Where does your site stand?

Four quick questions, then a straight answer.

1/4Have you checked your own site for this?
Summarize this page withChatGPTClaudePerplexityGoogleAI Mode
02Checklist

Add a route mapping

  1. 01Use a permanent redirect when a page has moved for good; reserve a temporary status such as 302 for a genuinely temporary destination. The default is 301 where statuses are supported.
  2. 02Dynamic redirects are allowed as long as the old and new routes contain the same parameters, for example /blog/[...slug] to /articles/[...slug]. Astro's config reference says you can redirect static and dynamic routes only to the same kind of route. Redirects to external http or https URLs need Astro v5.2.0 or later.
  3. 03Configured redirects have lower priority than an existing page file at the same path. Remove the old route if it shadows the mapping.
  4. 04Astro's config reference marks a config listing both /product1/ and /product1 as not supported. Let the host normalize slash behavior consistently.
  5. 05For a static site, use your host's redirect file or adapter support when a real HTTP status matters to search engines and non-browser clients.
astro.config.mjs
import { defineConfig } from 'astro/config'

export default defineConfig({
  redirects: {
    '/old-guide': '/new-guide',
    '/news': {
      status: 302,
      destination: 'https://example.com/news'
    }
  }
})
03How it works

Test migrations before and after release

Google recommends a permanent server-side redirect whenever possible to change the URL shown in search results. See the 301 redirect guide, Astro routing and redirects, and the redirect chains diagnostic.

  1. 01

    Build and inspect generated files

    Search the build output for the old route. Confirm whether it contains meta refresh HTML or whether an adapter wrote host-level redirect rules.

  2. 02

    Request the deployed old URL

    Check status, Location, destination status, and whether the final page is the intended equivalent. Use GET as well as HEAD if your host handles those methods differently.

  3. 03

    Test path variants and query strings

    Check trailing slash behavior, encoded paths, and campaign parameters. Make sure each old URL reaches one final canonical destination without a chain or loop.

  4. 04

    Update internal references

    Change navigation, canonical tags, and links to point directly at the destination. Keep the redirect for external backlinks and bookmarks.

Questions

Asked a lot.

3 questions people ask next, answered from the sources on this page.

01Does Astro return a 301 for a static redirect?

Not without an adapter that handles redirects. Astro's static build outputs an HTML page with a meta refresh tag, and the status code is not used by the server. Use SSR, a supported static adapter, or host-level redirect support when you need a real HTTP status.

02Why is my Astro redirect ignored?

A file-based route at the same path takes precedence over a configured redirect, as the routing guide says. Remove or rename the conflicting route, rebuild, and test the deployed response.

03Can Astro redirect a dynamic route to a static page?

Configured dynamic redirects require matching route parameter patterns on both sides. Use an explicit rule or host-level logic for a different route shape.

Sources · 3

Every fact, linked and dated.

Official docs first. The date is when we last opened each page.
  • astro.build
  • google.com
  1. 01Routing | Astro Docsdocs.astro.build · checked 2026-10-24
  2. 02Configuration Reference: redirects | Astro Docsdocs.astro.build · checked 2026-10-24
  3. 03Redirects and Google Search | Google Search Centraldevelopers.google.com · checked 2026-10-24
Free · 2 minutes

Tools point. Agencies advise. This one ships.

Run the free audit, then approve the fixes. Every change can be undone.

Free, no card60 secondsNobody will call you
  • 46 fixes shipped without a ticket Brightpipe
  • 0→7 ChatGPT citations in six weeks Paylane