- - Site preview

Redirect 301 in SvelteKit

<script context="module">
 export async function load() {
  return {
   status: 301,
   redirect: '../new-url'
  };
 }
</script>

or

<script>
    import { redirect } from 'svelte-routing';
    import { get } from 'svelte/store';

    const url = get(store.url);
    const params = get(store.params);

    const redirect301 = () => {
        redirect(301, url, params);
    };
</script>