DEV Community

Vansh Wadhwa
Vansh Wadhwa

Posted on

1 1 1 1 1

How to Redirect to an external website with Remix

Remix has a useful redirect helper function which helps to quickly create a new redirect Response. You can use this function to redirect from a loader or action to another app route and another website.

import { redirect } from "@remix-run/node";

export const action = async () => redirect("https://vanxh.dev");
Enter fullscreen mode Exit fullscreen mode

Just return a redirect response with the URL you want to redirect. You can also pass a status code as a second argument, which defaults to 302.

You can do the same from a loader:

export const loader = async () => redirect("https://vanxh.dev");
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

The best way to debug slow web pages cover image

The best way to debug slow web pages

Tools like Page Speed Insights and Google Lighthouse are great for providing advice for front end performance issues. But what these tools can’t do, is evaluate performance across your entire stack of distributed services and applications.

Watch video

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay