react router with dynamic routes give 404 on a browser direct link

前端 未结 1 1295
南旧
南旧 2020-12-20 04:30

I have a React Front-end connected to Wordpress API and the routes are defined in clientside with React Router. When i use Link<

相关标签:
1条回答
  • 2020-12-20 04:47

    Check this out: https://github.com/rafrex/spa-github-pages

    The concept might help you.

    When the GitHub Pages server gets a request for a path defined with frontend routes, e.g. example.tld/foo, it returns a custom 404.html page. The custom 404.html page contains a script that takes the current url and converts the path and query string into just a query string, and then redirects the browser to the new url with only a query string and hash fragment.

    0 讨论(0)
提交回复
热议问题