2

This is the code i have used for redirection.

It is redirecting to

http://localhost:3000/something/https://example.zendesk.com/hc/en-us/articles/123456789-Privacy-Policies

instead of

https://example.zendesk.com/hc/en-us/articles/123456789-Privacy-Policies
<Link
  to={{
    pathname:
      "https://example.zendesk.com/hc/en-us/articles/123456789-Privacy-Policies"
  }}
  target="_blank"
>
  <Button variant="contained" className="py-1 px-2">
    <i className="ri-upload-2-line pe-2"></i> Apply
  </Button>
</Link>
keikai
  • 14,085
  • 9
  • 49
  • 68
Shelcia
  • 41
  • 1
  • 4

2 Answers2

0

I think react-router attempt assuming relative path, if you want absolute link you can use directly tag a instead of Link component.

<a href="https://example.zendesk.com/hc/en-us/articles/123456789-Privacy-Policies" target="_blank">
  <Button
    variant="contained"
    className="py-1 px-2">
      <i className="ri-upload-2-line pe-2"></i> Apply
  </Button>
</a>
GABORIEAU
  • 61
  • 3
-2

Next.js Link is designed to be used only as a internal routing tool, because it works with next.js router. For external link use standart anchor tag <a href...

Wraithy
  • 1,722
  • 1
  • 5
  • 13