diff --git a/src/content/partials/workers/redirects.mdx b/src/content/partials/workers/redirects.mdx index 77953f416e9f681..10a5215b368eefc 100644 --- a/src/content/partials/workers/redirects.mdx +++ b/src/content/partials/workers/redirects.mdx @@ -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. @@ -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 ```