Relative Content

Tag Archive for reactjsnext.jsroutesnext-router

Routing resets to home on refresh for Next.js Site Deployed to Firebase Hosting

I have created a static website using Next.js and Tailwind CSS with several pages, including Home, Services, and Contact. Each route correctly navigates to its respective page. Everything works fine on localhost, but when I deploy the build to Firebase Hosting, the routes work only if I don’t refresh the page. If I refresh the page, the site defaults to the Home page and I can’t navigate to other pages. For example, if I navigate to the Services page and then refresh the page, it shows the Home page while the URL still indicates the Services page.