Skip to content

Internal Route Redirection

If you prefer to use Astro components for your maintenance page, you can redirect to a custom route in your Astro project. This offers greater flexibility to customize the page to your needs.

maintenance({
enabled: true,
template: "/custom-maintenance", // Redirects to this route in your Astro site
override: "preview",
})

This performs a 302 redirect to the specified route when maintenance mode is enabled. You’ll need to:

  1. Create a page at the specified route in your Astro project (e.g., /src/pages/custom-maintenance.astro)
  2. Build your maintenance page using Astro components, layouts, and styles

This approach lets you use all of Astro’s features for your maintenance page, including:

  • Astro components
  • Your site’s existing layouts
  • CSS frameworks or styling solutions
  • Client-side JavaScript when needed

Now that you’ve learned about all the available templates, check out these resources: