mars / create-react-app-buildpack

⚛️ Heroku Buildpack for create-react-app: static hosting for React.js web apps
MIT License
3.28k stars 653 forks source link

rewrite all to index.html #86

Closed dht closed 6 years ago

dht commented 6 years ago

In our project we use react-router-dom and we defined a route:

/example.com/referral

It will not work when navigating directly to it as not all routes are redirected to:

/build/index.html

How can I rewrite all routes to /build/index.html?

mars commented 6 years ago

The routes directive of static.json is designed to solve this problem.

dht commented 6 years ago

Do I just put the static.json in the root folder?

mars commented 6 years ago

@dht yes