Permanent page move
- Status
- 308 (or 301)
- Why
- Signals that the new URL replaces the old one
Use SvelteKit’s server-side redirect helper for moved routes, choose a status based on whether the move is permanent, and verify the deployed response.
In SvelteKit, import redirect from @sveltejs/kit and call it during request handling, for example in a server load function. Use 308 when the URL has moved for good, and 307 when it may return. Don't catch the thrown redirect, and check the deployed response for the expected status and Location.
Four quick questions, then a straight answer.
From your answers, this is quietly costing you traffic and nobody has the hours to chase it. Scaplet finds every affected page, drafts the fixes and tracks how AI answers mention you.
A data platform shipped 46 fixes without a ticket.
This looks handled. Re-check after a redesign, a migration or a big content push; that is when it breaks.
Your site is small and you have the time. Work through the steps on this page, starting with the pages that get the most traffic.
redirect is called during request handling, SvelteKit returns a redirect response, and that you must make sure you are not catching the thrown redirect. In load functions, don’t call it inside a try {...} block, because the redirect will immediately trigger the catch statement. Since SvelteKit 2 you call redirect(...) directly and don’t throw it. The example uses 308 for a permanent path change; use a real old-to-new map rather than deriving a destination from untrusted input.external option, either true or an array of allowed origins, for example redirect(307, 'https://example.com', { external: true }). Prefer the array of allowed origins when you know the destinations.import { redirect } from '@sveltejs/kit'
import type { PageServerLoad } from './$types'
export const load: PageServerLoad = () => {
redirect(308, '/guides/current-guide')
}For an A/B test that redirects users to a variation URL, Google says to use a 302 (temporary) redirect, not a 301. Keep a redirect inventory with source, target, reason, status, and owner so future migrations do not add competing rules.
Use curl -I https://example.com/old-path against the deployed site and inspect the status and Location header.
Use curl -IL to check every hop. The chain should end at a successful page, not a loop or another redirect.
Confirm it is the intended page, has a self-consistent canonical, and returns the expected language or path variant.
Change internal links and sitemap entries to the final URL so visitors and crawlers do not repeatedly traverse old paths.
For related URL signals, read canonical URLs, redirect chains, and 301 redirects. A redirect status can be lost when a reverse proxy, CDN rule, or static hosting configuration overrides the framework output, so capture response headers from the public domain after each deployment.
3 questions people ask next, answered from the sources on this page.
Import redirect from @sveltejs/kit and call it in a server load function, for example redirect(308, '/new-path'). SvelteKit handles the thrown redirect as long as you don’t catch it.
Google treats both as permanent. SvelteKit’s docs list 308 as a common code that keeps the request method; 301 is also accepted by redirect. Test the deployed response either way.
A static file cannot run redirect per request. SvelteKit’s adapter API exposes redirects found during prerendering, but check what your adapter does and verify the response with curl -I.
Run the free audit, then approve the fixes. Every change can be undone.