File: redirects.md | Updated: 11/15/2025
Hide navigation
Search
Ctrl K
Home Guides EAS Reference Learn
Archive Expo Snack Discord and Forums Newsletter
Copy page
Learn how to redirect URLs in Expo Router.
Copy page
You can redirect a request to a different URL based on some in-app criteria. Expo Router supports a number of different redirection patterns.
You can immediately redirect from a particular screen by using the Redirect component:
import { View, Text } from 'react-native'; import { Redirect } from 'expo-router'; export default function Page() { const { user } = useAuth(); if (!user) { return <Redirect href="/login" />; } return ( <View> <Text>Welcome Back!</Text> </View> ); }
You can also redirect imperatively with the useRouter hook:
import { Text } from 'react-native'; import { useRouter, useFocusEffect } from 'expo-router'; function MyScreen() { const router = useRouter(); useFocusEffect(() => { // Call the replace method to redirect to a new route without adding to the history. // We do this in a useFocusEffect to ensure the redirect happens every time the screen // is focused. router.replace('/profile/settings'); }); return <Text>My Screen</Text>; }