Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

184
Views
Why my sub url can not be accessed directly after a deploy my react project on server?

I built a react project. The react version is 17.0.2 and the react-router-dom version is 6.2.1. I used "npm run build" and deployed the build folder to the server. The site can be visited and the site can jump to any specific page when I click the link button on the homepage or any other pages. But except homepage, when I refresh the page or I use the URL to visit this page, it will show "not found". This situation doesn't appear on local when I code. What is causing this problem and how to address it? Thanks! The following is part of my code on index.js and app.js

index.js

ReactDOM.render(
  <Provider store={store}>
    <BrowserRouter>
      <PersistGate persistor={persistor}>
        <App />
      </PersistGate>
    </BrowserRouter>
  </Provider>,
  document.getElementById("root")
);

app.js

function App() {
 return (
    <div>
      <Header />
      <Routes>
        <Route path="/" element={ <Landingpage />} exact />
        <Route path="/aboutus" element={ <AboutUsPage />} />
        <Route path="/myservice" element={ <MyServicePage />} />
        <Route path="/portfolio" element={ <PortfolioPage />} exact />
        <Route path="/portfolio/:projectId" element={ <ProjectPage />} />
        <Route path="/contact" element={ <ContactPage />} />
      </Routes>
    </div>
  );
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!