From 297ce6ab2860b11912c8b6b01750c90e80045482 Mon Sep 17 00:00:00 2001 From: Ade Viankakrisna Fadlil Date: Sun, 5 Mar 2017 21:07:19 +0700 Subject: [PATCH] Add docs for apache's client side routing setting (#1717) * Add docs for apache's client side routing setting * Tweak advice --- packages/react-scripts/template/README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/react-scripts/template/README.md b/packages/react-scripts/template/README.md index 3c95313946b..4f48c05bda0 100644 --- a/packages/react-scripts/template/README.md +++ b/packages/react-scripts/template/README.md @@ -1250,6 +1250,17 @@ This is because when there is a fresh page load for a `/todos/42`, the server lo }); ``` +If you’re using [Apache](https://httpd.apache.org/), you need to create a `.htaccess` file in the `public` folder that looks like this: + +``` + Options -MultiViews + RewriteEngine On + RewriteCond %{REQUEST_FILENAME} !-f + RewriteRule ^ index.html [QSA,L] +``` + +It will get copied to the `build` folder when you run `npm run build`. + Now requests to `/todos/42` will be handled correctly both in development and in production. ### Building for Relative Paths