Redirects

Is this a valid way to redirect on the server side and will it provide a good redirectCode to search engines?

An old route url would only appear on some other website, not inside the website, so it would always run on the server side.

// my-old-route.vue

<script setup lang="ts">
const route = useRoute("my-old-route");

navigateTo(
  {
    name: "new-route",
  },
  {
    redirectCode: 301,
  }
);
</script>
Was this page helpful?