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>
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>
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...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.