From 10f403f1b265c418caa70c6861ae46f5c4516c0a Mon Sep 17 00:00:00 2001 From: Jose Quintana Date: Mon, 15 Aug 2022 22:33:09 +0200 Subject: [PATCH] docs: redirect trailing slash page [skip ci] --- docs/content/configuration/command-line-arguments.md | 4 ++-- docs/content/configuration/environment-variables.md | 2 +- docs/content/features/trailing-slash-redirect.md | 12 ++++++++++++ docs/mkdocs.yml | 1 + 4 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 docs/content/features/trailing-slash-redirect.md diff --git a/docs/content/configuration/command-line-arguments.md b/docs/content/configuration/command-line-arguments.md index 28c5c28..ac8f538 100644 --- a/docs/content/configuration/command-line-arguments.md +++ b/docs/content/configuration/command-line-arguments.md @@ -10,7 +10,7 @@ The server can be configured via the following command-line arguments. ``` $ static-web-server -h -static-web-server 2.10.0 +static-web-server 2.11.0 Jose Quintana A blazing fast and asynchronous web server for static files-serving. @@ -89,7 +89,7 @@ OPTIONS: a generic HTML error message [env: SERVER_ERROR_PAGE_50X=] [default: ./public/50x.html] -p, --port Host port [env: SERVER_PORT=] [default: 80] --redirect-trailing-slash - Check for trailing slash in the requested directory uri and redirect permanent (308) to the same path with a + Check for a trailing slash in the requested directory uri and redirect permanent (308) to the same path with a trailing slash suffix if it is missing [env: REDIRECT_TRAILING_SLASH=] [default: true] -d, --root Root directory path of static files [env: SERVER_ROOT=] [default: ./public] diff --git a/docs/content/configuration/environment-variables.md b/docs/content/configuration/environment-variables.md index 1540342..d081ed1 100644 --- a/docs/content/configuration/environment-variables.md +++ b/docs/content/configuration/environment-variables.md @@ -76,7 +76,7 @@ Enable cache control headers for incoming requests based on a set of file types. It provides [The "Basic" HTTP Authentication Scheme](https://datatracker.ietf.org/doc/html/rfc7617) using credentials as `user-id:password` pairs, encoded using `Base64`. Password must be encoded using the [BCrypt](https://en.wikipedia.org/wiki/Bcrypt) password-hashing function. Default empty (disabled). ### REDIRECT_TRAILING_SLASH -Check for trailing slash in the requested directory uri and redirect permanent (308) to the same path with a trailing slash suffix if it is missing. Default `true` (enabled). +Check for a trailing slash in the requested directory URI and redirect permanent (308) to the same path with a trailing slash suffix if it is missing. Default `true` (enabled). ## Windows The following options and commands are Windows platform-specific. diff --git a/docs/content/features/trailing-slash-redirect.md b/docs/content/features/trailing-slash-redirect.md new file mode 100644 index 0000000..a0e99ba --- /dev/null +++ b/docs/content/features/trailing-slash-redirect.md @@ -0,0 +1,12 @@ +# Trailing Slash Redirect + +**`SWS`** provides automatic trailing slash redirect support for directory requests. + +This feature is enabled by default and can be controlled by the boolean `--redirect-trailing-slash` option or the equivalent [SERVER_REDIRECT_TRAILING_SLASH](./../configuration/environment-variables.md#redirect_trailing_slash) env. + +```sh +static-web-server \ + --port 8787 \ + --root ./my-public-dir \ + --redirect-trailing-slash true +``` diff --git a/docs/mkdocs.yml b/docs/mkdocs.yml index 7ab7b5a..924b2a9 100644 --- a/docs/mkdocs.yml +++ b/docs/mkdocs.yml @@ -142,6 +142,7 @@ nav: - 'URL Rewrites': 'features/url-rewrites.md' - 'URL Redirects': 'features/url-redirects.md' - 'Windows Service': 'features/windows-service.md' + - 'Trailing Slash Redirect': 'features/trailing-slash-redirect.md' - 'Platforms & Architectures': 'platforms-architectures.md' - 'Migration from v1 to v2': 'migration.md' - 'Changelog v2 (latest stable)': 'https://github.com/joseluisq/static-web-server/blob/master/CHANGELOG.md' -- libgit2 1.7.2