Skip to content

Commit 2a6cb16

Browse files
committed
Small changes to format/grammar/etc.
1 parent e0843d5 commit 2a6cb16

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

docs/how-to/websites-on-ipfs/redirects-and-custom-404s.md

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ Redirect logic will only be evaluated if the requested path is not in the [DAG](
2020

2121
## How to set up
2222

23-
To define rules executed when requested path is not found in DAG, there must be a file named `_redirects` stored underneath the root CID of the website. This `_redirects` file must be a text file containing one or more lines that follow the format explained below.
23+
To define rules that will be executed when the requested path is not found in the DAG, there must be a file named `_redirects` stored underneath the root CID of the website. This `_redirects` file must be a text file containing one or more lines that follow the format explained below.
2424

25-
## Format of the `_redirects` file
25+
### Format of the `_redirects` file
2626

2727
Each line contained within the `_redirects` file has 3 basic components:
2828

@@ -34,13 +34,12 @@ from to [status]
3434
1. The `to` path. This specifies the path to be redirected to.
3535
1. The `status` component. This part is optional and specifies the HTTP status code that will be returned. (301, 404, etc.)
3636

37-
For example, if you removed `home.html` and want to temporarily redirect traffic from `home.html` page to your `index.html` page, the `_redirects` file should contain a line that looks something like this:
37+
For example, if you removed `home.html` and want to temporarily redirect traffic from `home.html` to `index.html`, the `_redirects` file should contain a line that looks something like this:
3838

3939
```plaintext
4040
/home.html /index.html 302
4141
```
4242

43-
4443
### Status codes
4544

4645
- `200` - OK (redirect will be treated as a rewrite, returning payload from alternative content path without changing the URL shown in the browser).
@@ -54,15 +53,15 @@ For example, if you removed `home.html` and want to temporarily redirect traffic
5453

5554
Placeholders are named variables that can be used to match path segments in the `from` path and inject them into the `to` path.
5655

57-
This is useful for redirecting users to their desired content, even if the way your website is organized changed .
56+
This is useful for redirecting users to their desired content, even if the way your website is organized changed.
5857

5958
For example, if I wanted to search for an article titled "hello world" that was written on June 15, 2022, I could search for it like this: `/posts/06/15/2022/hello-world` and be redirected to `/articles/2022/06/15/hello-world`
6059

6160
```plaintext
6261
/posts/:month/:day/:year/:title /articles/:year/:month/:day/:title 301
6362
```
6463

65-
There is also special catch-all placeholder named `:splat` which represents everything captured via `*`.
64+
There is also a special catch-all placeholder named `:splat` which represents everything captured via `*`.
6665

6766
```plaintext
6867
/blog/* /new-blog/:splat 302
@@ -77,7 +76,6 @@ There is no overwrite/shadowing: the file is evaluated only when requested path
7776
For more detailed information about supported features, check out the [`_redirects` file specification](https://github.com/ipfs/specs/blob/main/http-gateways/REDIRECTS_FILE.md).
7877
:::
7978

80-
8179
## Examples
8280

8381
### Catch all and PWA/SPA support
@@ -93,7 +91,7 @@ Opening `/app/this-does-not-exist` will return HTTP 200 response with content fr
9391
### Redirect an old URL to a new place
9492

9593
The `301` status is a permanent redirect, this is the default status code used when no code is specified.
96-
Below two rules mean the same:
94+
The two rules below mean the same thing:
9795

9896
```plaintext
9997
/old/docs.html /new/documentation.html
@@ -106,12 +104,12 @@ The `302` status is commonly used for temporary redirects.
106104
/home /under-construction.html 302
107105
```
108106

109-
For advanced and catch-all redirects, see [Placeholders](#placeholders) below.
107+
For advanced and catch-all redirects, see [Placeholders](#placeholders).
110108

111109
### Add a custom 404 page to your website
112110

113111
Since the `_redirects` is evaluated only when requested path does not exist,
114-
it is possibleto define a custom 404 page for your website:
112+
it is possible to define a custom 404 page for your website:
115113

116114
```plaintext
117115
/* /custom-404.html 404

0 commit comments

Comments
 (0)