'React router 404 Error On (Litespeed Webserver)

I am building movie app, initialize with create-react-app. I am using react-router@5. I get 404 Error when route url on production (on Litespeed webserver) but it's work on local machine.

Example Url :

www.example.com/tv/detail/131959 

I am research on issue and found .htaccess file configuration, but configuration for apache or tomcat and I use litespeed web server.

AppRouter.js

const AppRouter = () => {
  return (
    <BrowserRouter >
      <Navbar />
      <ScrollToTop />
      <Switch>
        <Route exact path="/" component={App} />
        <Route exact path="/:type/detail/:id" component={DetailPage} />
      </Switch>
    </BrowserRouter>
  )
};

For inspect visit github repo: https://github.com/egecanyldrm/movie_app

.htaccess config

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /
  RewriteRule ^index\.html$ - [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule . /index.html [L]
</IfModule>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source