Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/content/partials/workers/redirects.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,19 @@ Only one redirect can be defined per line and must follow this format, otherwise

- Optional parameter

### Comments

Lines starting with a `#` will be treated as comments.

You can also add inline comments to redirect rules. Any `#` token that appears after the `source` and `destination` (and optional `code`) will be treated as the start of a comment and ignored. URL fragments (for example, `/page#section`) are not affected because they do not have a space before the `#`.

```txt
# Full-line comment explaining the next group of redirects
/old-page /new-page 301 # Moved during site redesign
/blog/* /articles/:splat # Blog URL migration
/page /page2#section 301 # URL fragment is preserved
```

### Per file

A `_redirects` file is limited to 2,000 static redirects and 100 dynamic redirects, for a combined total of 2,100 redirects. Each redirect declaration has a 1,000-character limit.
Expand All @@ -67,7 +78,7 @@ A complete example with multiple redirects may look like the following:
/trailing /trailing/ 301
/notrailing/ /nottrailing 301
/page/ /page2/#fragment 301
/blog/* https://blog.my.domain/:splat
/blog/* https://blog.my.domain/:splat # Blog migration
/products/:code/:name /products?code=:code&name=:name
```

Expand Down
Loading