You built your app with Lovable, Bolt, Cursor or Replit and moved it to your own hosting, such as Vercel or Netlify. The home page loads and every button works. But refresh the page on /dashboard, or open a link straight to /login, and you get a 404 page. You may never notice, because you always start from the home page. Your users don't. They open links from emails, bookmarks and shared messages, and those land on the 404.
The short answer
Many AI-built apps are single-page apps (SPAs). The whole app is one file, index.html, and JavaScript in the browser decides what to show for /login or /dashboard. When you click a link inside the app, the browser never asks the server for /login. When you refresh or open a link directly, it does, and the server has no file called /login, so it answers 404.
The fix is one rule that tells your host: for any path that isn't a real file, serve index.html and let the app handle it. Lovable's own guide to hosting outside Lovable gives the same advice: if direct URL navigation returns a 404, add a fallback rewrite so all routes serve /index.html.
Why this breaks sign-up and login
This isn't just an annoyance on one page. If your confirmation or password reset email sends people to a page like /reset-password or /welcome, that link opens the page directly, so it hits the same 404. The same goes for any link you share to /login or /signup. Your app can look fine to you while new users can't get in.
First, check which kind of app you have
Lovable's docs split its apps into two kinds, and the fix only applies to one of them:
- Older React + Vite apps build to static files in
dist/. They need theindex.htmlfallback below. - TanStack Start apps (Lovable says these are projects created from 13 May 2026) run server code. Don't add the fallback. A 404 on these usually means the host isn't running the server part. Follow Lovable's TanStack Start hosting steps instead.
To tell which you have, Lovable says to open package.json: a TanStack Start project lists @tanstack/react-start under its dependencies. If you built with Bolt, Cursor or Replit, check package.json the same way. A Vite app with React Router and no server framework is a single-page app.
Fix on Vercel
Vercel's Vite guide says deep linking won't work out of the box for a Vite SPA. Create a file called vercel.json in the root of your project, next to package.json, containing:
{ "rewrites": [ { "source": "/(.*)", "destination": "/index.html" } ] }
Then redeploy. Vercel's 404 troubleshooting guide adds three things to check:
- The file has to be at the root of your repository and committed to Git. If it isn't committed, the rule never applies and Vercel shows no error.
- If your app also has API routes under /api, leave them out of the rule, or every API call gets your page instead:
{ "rewrites": [ { "source": "/((?!api/).*)", "destination": "/index.html" } ] } - If
cleanUrlsis set to true invercel.json, use/indexas the destination, without.html.
Fix on Netlify
Netlify's docs say a single-page app needs this rewrite rule, which serves index.html instead of a 404 for any URL:
/* /index.html 200
Put it in a plain text file named _redirects, with no file extension. Netlify reads that file from the folder it publishes, which for a Vite app is dist/. Vite copies everything in your public/ folder into dist/ when it builds, so save the file as public/_redirects. If you have other redirect rules, Netlify says this one usually goes last.
Netlify also notes that real files still win: the rule doesn't replace a file that actually exists at that path, which is what you want for images and scripts.
Fix on Cloudflare Pages
Cloudflare's docs say that if your project has no top-level 404.html file, Pages assumes it is a single-page app and serves your home page for any path that isn't a real file. So if you get 404s on Cloudflare Pages, check whether your build output includes a 404.html at the top level.
A prompt you can paste into your AI tool
If you'd rather have your AI tool make the change, paste this:
"When I refresh a page or open a link directly, like /login, my deployed app shows a 404. Check whether this project is a single-page app. If it is, add the fallback rewrite my host needs so every route serves index.html (vercel.json at the project root for Vercel, or public/_redirects with /* /index.html 200 for Netlify), keep any /api routes working, and don't change anything else."
Check the change before you deploy it: the file should be in the right place and match the rule above.
How to confirm it's fixed
After you redeploy:
- Open your live site, go to a page other than the home page, and refresh it.
- Paste a direct link to your login and sign-up pages into a new private browser window.
- Click the link in a real confirmation or password reset email from your app.
All three should load the right page, not a 404. You can also paste a direct link, such as yourapp.com/login, into the free FlowCanary check. It opens the URL in a real browser and reports the HTTP status, so a 404 shows up straight away.
Catch silent breaks before your users do
This kind of break is easy to miss because the app works perfectly when you click through it yourself. Scheduled testing from FlowCanary is launching by 30 November 2026. Once it is live, it will test the flows a new visitor can do in your app, such as sign-up and checkout, in a real browser on a schedule, with logged-in flows on Pro, and tell you in plain English when one breaks, with a fix prompt for Lovable, Bolt, Cursor or Replit. Until then, the free check works today.
Sources
- Lovable, Deploying and hosting outside Lovable: https://docs.lovable.dev/tips-tricks/external-deployment-hosting
- Vercel, Vite on Vercel: https://vercel.com/docs/frameworks/frontend/vite
- Vercel, Why is my deployed project giving 404?: https://vercel.com/kb/guide/why-is-my-deployed-project-giving-404
- Netlify, Rewrites and proxies: https://docs.netlify.com/manage/routing/redirects/rewrites-proxies/
- Netlify, Redirects and rewrites overview: https://docs.netlify.com/manage/routing/redirects/overview/
- Vite, The public directory: https://vite.dev/guide/assets.html#the-public-directory
- Cloudflare, Serving Pages: https://developers.cloudflare.com/pages/configuration/serving-pages/