Jpark9061
Jpark9061

Reputation: 1110

Firebase hosting redirected website doesnt have all pages

I have a React app that is hosted by Firebase and bought a custom domain www.encor.cc so that my app can get deployed on this url. However, even after redirecting my custom url (encor.cc) to the firebase deployed web url (adripa-4771c.web.app), encor.cc lacks every other page except for the main '/' page.

If I visit encor.cc right now only the landing page works and every other pages give me a 404. However, all the pages works in adripa-4771c.web.app

Any suggestions on how to fix this? Thank you

This is my firebase console overview:

firebase hosting console

EDIT:

This is how I set up my links with react-router-dom. Also, my app is set up with create-react-app.

ReactDOM.render(
  <ThemeProvider theme={theme}>
    <Router history={history}>
      <Switch>
        <Route exact path="/" component={Landing} />
        <Route exact path="/register" component={Register} />
        <Route exact path="/login" component={Login} />
        <Route exact path="/admin" component={Admin}/>
        <Route exact path='/:user' component={User}/>
        <Route exact path='/l/terms' component={Terms}/>
        <Route exact path='/l/privacy' component={Privacy}/>
        <Route exact path='/l/contact' component={Contact}/>
        <Route exact path='/l/blog' component={Blog}/>
        <Route exact path='/l/faq' component={Faq} />
        <Route exact path='/l/about' component={About}/>
        <Route exact path='/l/plans' component={Plans}/>
        <Route exact path='/l/forgot' component={Forgot}/>
      </Switch>
    </Router>
  </ThemeProvider>,
  document.getElementById('root')
);

Upvotes: 0

Views: 702

Answers (1)

Jpark9061
Jpark9061

Reputation: 1110

Adding this seemed to solve the problem

    "rewrites": [
      {
        "source": "**",
        "destination": "/index.html"
      }
    ]

Upvotes: 1

Related Questions