Netlify "page not found" when sharing React-Router-Dom based links

Hi, @brianjychan. The redirect rule you posted wouldn’t make that change.

The issue has to do with how the assets are referenced in the HTML. For example:

href="/manifest.json"

That will always load manifest.json from the site root.

However, if the reference one of these below instead:

href="manifest.json"

or:

href="./manifest.json"

Then the URL used for the HTTP request will be relative to the current path.

Would you please send us a link to the site? If so, we will be happy to see if that is the issue or not.

I found the issue! In my package.json, I had marked homepage as "./", so changing it to "/" removed the error. Thanks @luke your point tipped me off to it.

2 Likes

Thanks! This works just fine

1 Like

Thank you for this. This worked like a charm.

2 Likes

Amazing! This worked for me as well when I was trying to redirect via react-select or directly typing a path into my browser :+1:

Thank you so much!!

With this answer, I solve my problem in 3 min.

Keep going!

Regards

Jonas

1 Like

Glad this got you on the right path! Happy building :netliconfetti:

3 posts were split to a new topic: Eleventy to redirect to an Obsidian Publish

Just wanted to chime in and say thanks!! This worked for me too!

This was the key to my resolution. My build script was setting my homepage to ./ and changing it to / (as well as creating a _redirects file as described above) fixed it. Thank you!

1 Like

Thanks for coming back and letting us know! I am glad that this got you on the right track. Happy building :rocket:

For me too! simple solution!

1 Like

Hey jaylowe1

You just saved a drowning man by giving a straw :sweat_smile: , was facing same issue but now it’s working fine .
Thank You So Much

Hello @noberto.filho and @Sualeh :wave:t6:! I am glad to hear our solution was able to get your back on track. We really appreciate your feedback.