From 6dad58d72bb8b6c889ae1e82d69f9ca2e7d5bdc0 Mon Sep 17 00:00:00 2001 From: Mars Hall Date: Mon, 1 Aug 2016 09:44:54 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9A=20doc=20Routing=20with=20clean=20U?= =?UTF-8?q?RLs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 8653e515..72ccc9d4 100644 --- a/README.md +++ b/README.md @@ -70,15 +70,27 @@ Customization The web server may be [configured via the static buildpack](https://github.com/heroku/heroku-buildpack-static#configuration). -The default config, if `static.json` does not already exist, is: +The default `static.json`, if it does not exist in the repo, is: ```json { "root": "build/" } ``` -### Router Push State +### Routing clean URLs -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**. +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`. + +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): + +```json +{ + "root": "build/", + "clean_urls": false, + "routes": { + "/**": "index.html" + } +} +``` Architecture 🏙