Vercel deployment returns 404 error on page refresh for internal links

Hello!

Problem

My Vercel project seems to be working fine until the page is refreshed while the user is on an internal link (such as /profile), at which point it returns a 404 error.

Current Behavior

  • Navigating via internal links works correctly.
  • Refreshing the page on any route other than the root results in a 404 error.

Are there any fixes to this or is it just user error?

There’s another community post with 404 debugging tips that might be helpful. Please give these solutions a try and let us know how it goes.

A human should be around soon to offer more advice. But you can also get helpful information quickly by asking v0.

Did you check the link shared above?

Yes, I did, thanks - I’ve not been able to put into effect to see if it worked yet but I plan too soon so will see soon!

Update to this - found the fix! All that had to be done was to create a vercel.json file and put the following code below in it to work! So if anyone runs into a similar issue, this will probably help :slight_smile:

vercel.json

{

  "rewrites": [

    {

      "source": "/(.*)",

      "destination": "/index.html"

    }

  ]

}

Thanks for sharing what worked for you!