React Redirect to another url code example

Example 1: external site links in react Link

<Link to={{ pathname: "https://example.zendesk.com/hc/en-us/articles/123456789-Privacy-Policies" }} target="_blank" />

Example 2: javascript redirect

window.location.href = "http://mywebsite.com/home.html";

Example 3: how to redirect a page to another url in html

<meta http-equiv="Refresh" content="0; url=https://www.w3docs.com" />

Example 4: jquery redirect to another webpage

$(location).attr('href', 'https://google.com');

Example 5: react redirect to url

import { Route, Redirect } from 'react-router'

<Route exact path="/" render={() => (
  loggedIn ? (
    <Redirect to="/dashboard"/>
  ) : (
    <PublicHomePage/>
  )
)}/>

Example 6: how to redirect to a website in react

window.location.href = 'http://domain.com';