Pages Redirect to Homepage When Accessed Directly on Vercel

Hello everyone,

I’m hosting a project on Vercel, and I’m experiencing an issue where all pages redirect to the homepage when accessed directly through their URLs. For example:

  • Navigating to /about or /contact from the homepage works fine.
  • However, if I open /about or /contact directly in a new browser tab or paste the URL, it redirects back to /.

Here are some details about my setup:

  • Framework: [Insert framework, e.g., Next.js, React, or Vite]
  • Hosting: Vercel
  • Domain: Custom domain connected through Vercel (DNS configured with ns1.vercel-dns.com and ns2.vercel-dns.com).

What I’ve tried so far:

  1. Verified DNS records: A record (@) points to 76.76.21.21, and CNAME (www) points to cname.vercel-dns.com.
  2. Checked browser console and server logs: No specific errors related to routing or redirects.
  3. Reviewed the vercel.json configuration for potential rewrite or redirect rules that could be causing this behavior.
  4. Ensured client-side routing and server-side logic are correctly configured.

The issue persists regardless of what I’ve tried.

Question:
Why is this happening, and how can I fix it so that pages load properly when accessed directly by URL? Are there specific configurations in Vercel I might be overlooking?

Any guidance would be greatly appreciated. Thank you!

Hi, @alexanfr-god! Welcome to the Vercel Community :smile:

It looks like you managed to get this working! Feel free to share the solution with fellow community members.