Skip to content
This repository was archived by the owner on Jun 11, 2022. It is now read-only.

Commit 6dad58d

Browse files
authored
📚 doc Routing with clean URLs
1 parent 06346ab commit 6dad58d

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,27 @@ Customization
7070

7171
The web server may be [configured via the static buildpack](https://github.com/heroku/heroku-buildpack-static#configuration).
7272

73-
The default config, if `static.json` does not already exist, is:
73+
The default `static.json`, if it does not exist in the repo, is:
7474

7575
```json
7676
{ "root": "build/" }
7777
```
7878

79-
### Router Push State
79+
### Routing clean URLs
8080

81-
To support clean URLs with React Router (not included), configure with [HTML5 Push State](https://gist.github.com/hone/24b06869b4c1eca701f9#html5-push-state) from **Getting Started with Single Page Apps on Heroku**.
81+
By default, [React Router](https://github.com/reactjs/react-router) (not included) uses hash-based URLs like `https://example.com/index.html#/users/me/edit`. This is nice & easy when getting started with local development, but for a public app you probably want real URLs like `https://example.com/users/me/edit`.
82+
83+
Create a `static.json` file to configure the web server for clean [`browserHistory` URLs with React Router](https://github.com/reactjs/react-router/blob/master/docs/guides/Histories.md#browserhistory):
84+
85+
```json
86+
{
87+
"root": "build/",
88+
"clean_urls": false,
89+
"routes": {
90+
"/**": "index.html"
91+
}
92+
}
93+
```
8294

8395

8496
Architecture 🏙

0 commit comments

Comments
 (0)