From a8143d641a665b2b3ee4311bc232e0032ab05f19 Mon Sep 17 00:00:00 2001 From: "M. Heide" Date: Thu, 3 Jun 2021 01:12:43 +0200 Subject: [PATCH 1/2] [readme] Add details + example for "rewrite" --- README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d17c1d5..b9ee5f9 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,9 @@ However, you can also restrict it to certain paths: ### rewrites (Array) -If you want your visitors to receive a response under a certain path, but actually serve a completely different one behind the curtains, this option is what you need. +If you want your visitors to receive a response under a certain path, but actually serve a completely different one behind the curtains, this option is what you need. + +Rewrites will only be applied if no file with the requested path was found. It's perfect for [single page applications](https://en.wikipedia.org/wiki/Single-page_application) (SPAs), for example: @@ -124,6 +126,16 @@ It's perfect for [single page applications](https://en.wikipedia.org/wiki/Single } ``` +Or simply: + +```json +{ + "rewrites": [ + { "source": "**", "destination": "/index.html" } + ] +} +``` + You can also use so-called "routing segments" as follows: ```json From ae9d75792c7f2676e13682b49e39b846d95ed090 Mon Sep 17 00:00:00 2001 From: "M. Heide" Date: Thu, 3 Jun 2021 01:15:16 +0200 Subject: [PATCH 2/2] [readme] Revert extra spaces --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b9ee5f9..d5bb1f2 100644 --- a/README.md +++ b/README.md @@ -111,7 +111,7 @@ However, you can also restrict it to certain paths: ### rewrites (Array) -If you want your visitors to receive a response under a certain path, but actually serve a completely different one behind the curtains, this option is what you need. +If you want your visitors to receive a response under a certain path, but actually serve a completely different one behind the curtains, this option is what you need. Rewrites will only be applied if no file with the requested path was found.