Trailing slash behavior in URLs
The field Trailing Slash Configuration has three options: Do Not Change, Remove, and Normalize. This topic provides examples showing how those options affect the lookup process for asset requests.
Suppose your site has assets at the following URLs:
- http://example.com/breakfast (permalink is
/breakfast). - http://example.com/lunch/ (permalink is
/lunch/, internally stored as/lunch/index).
The following table shows how Brightspot receives a requested URL and, depending on the value of Trailing Slash Configuration, determines the asset to return.
| Requested URL | Returned asset |
|---|---|
| Do Not Change—Brightspot does not modify the URL of the requested asset. | |
| http://example.com/breakfast | Asset with permalink /breakfast. |
| http://example.com/breakfast/ | There is no asset with permalink /breakfast/, so Brightspot returns a not found (error 404). |
| http://example.com/lunch | There is no asset with permalink /lunch, so Brightspot returns a not found (error 404). |
| http://example.com/lunch/ | Asset with permalink /lunch/. |
| http://example.com/dinner | There is no asset with permalink /dinner, so Brightspot returns a not found (error 404). |
| http://example.com/dinner/ | There is no asset with permalink /dinner/, so Brightspot returns a not found (error 404). |
| Remove—Brightspot removes a trailing slash unless an asset exists at the returned URL. | |
| http://example.com/breakfast | Asset with permalink /breakfast. |
| http://example.com/breakfast/ | There is no asset with permalink /breakfast/, so Brightspot removes the trailing slash and returns the asset with permalink /breakfast. |
| http://example.com/lunch | There is no asset with permalink /lunch, so Brightspot returns a not found (error 404). |
| http://example.com/lunch/ | Asset with permalink /lunch/. |
| http://example.com/dinner | There is no asset with permalink /dinner, so Brightspot returns a not found (error 404). |
| http://example.com/dinner/ | There is no asset with permalink /dinner/, so Brightspot removes the trailing slash and attempts to return the asset with permalink /dinner. There is no asset with that permalink so Brightspot returns a not found (error 404). |
| Normalize—Brightspot adds or removes the trailing slash as necessary to match an existing URL. | |
| http://example.com/breakfast | Asset with permalink /breakfast. |
| http://example.com/breakfast/ | There is no asset with permalink /breakfast/, so Brightspot removes the trailing slash and returns the asset with permalink /breakfast. |
| http://example.com/lunch | There is no asset with permalink /lunch, so Brightspot adds the trailing slash and returns the asset with permalink /lunch/. |
| http://example.com/lunch/ | Asset with permalink /lunch/. |
| http://example.com/dinner | There is no asset with permalink /dinner, so Brightspot adds the trailing slash and attempts to return the asset with permalink /dinner/. There is no asset with that permalink, so Brightspot returns a not found (error 404). |
| http://example.com/dinner/ | There is no asset with permalink /dinner/, so Brightspot removes the trailing slash and attempts to return the asset with permalink /dinner. There is no asset with that permalink, so Brightspot returns a not found (error 404). |