-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Redirects #7067
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Redirects #7067
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
46e7269
Redirects spike
matthewp ef3ea94
Allow redirects in static mode
matthewp d6b7104
Support in Netlify as well
matthewp f52116a
Adding a changeset
matthewp a70820b
Rename file
matthewp 475294a
Merge branch 'main' into redirects-ssg
matthewp eed6a72
Fix build problem
matthewp 1749ce5
Refactor to be more modular
matthewp ab0539b
Fix location ref
matthewp 83ed366
Late test should only run in SSR
matthewp e9e4d72
Merge branch 'main' into redirects-ssg
matthewp 4857c7d
Support redirects in Netlify SSR configuration (#7167)
matthewp 25d7d20
Implement support for dynamic routes in redirects (#7173)
matthewp 11a517b
Merge branch 'main' into redirects-ssg
matthewp ffc771e
Implement support for redirects config in the Vercel adapter (#7182)
matthewp f55e422
Add support for the object notation in redirects
matthewp 2904ced
Merge branch 'main' into redirects-ssg
matthewp c2f889b
Use status 308 for non-GET redirects (#7186)
matthewp af2ceea
Merge branch 'main' into redirects-ssg
matthewp 8b4d248
Implement redirects in Cloudflare (#7198)
matthewp ef9a456
Test that redirects can come from middleware (#7213)
matthewp fa03a41
Implement priority (#7210)
matthewp 02a8506
Merge branch 'main' into redirects-ssg
matthewp eb7617d
Refactor
matthewp d7d0b22
Fix netlify test ordering
matthewp fd52bd6
Merge branch 'main' into redirects-ssg
matthewp a39eb51
Fix ordering again
matthewp d3895a2
Redirects: Allow preventing the output of the static HTML file (#7245)
matthewp 2700c12
Do a simple push for priority
matthewp 60dcfb6
Adding changesets
matthewp c040279
Put the implementation behind a flag.
matthewp 79263e3
Self review
matthewp 5198529
Update .changeset/chatty-actors-stare.md
matthewp 63b5cfa
Update packages/astro/src/@types/astro.ts
matthewp 17d0538
Update packages/astro/src/@types/astro.ts
matthewp 7b64d65
Update packages/astro/src/@types/astro.ts
matthewp cd8e703
Update packages/astro/src/@types/astro.ts
matthewp 7fd2a0a
Update docs on dynamic restrictions.
matthewp 42bfa65
Update packages/astro/src/@types/astro.ts
matthewp 4da0c7b
Update packages/astro/src/@types/astro.ts
matthewp 3eaf936
Code review changes
matthewp 7c0905b
Document netlify static adapter
matthewp 63210fe
Update packages/astro/src/@types/astro.ts
matthewp 57e8105
Slight reword
matthewp 131f9d2
Update .changeset/twenty-suns-vanish.md
matthewp afcc209
Add a note about public/_redirects file
matthewp 4afaa37
Merge branch 'main' into redirects-ssg
natemoo-re 303b79a
Update packages/astro/src/@types/astro.ts
matthewp 33a9d5f
Merge branch 'main' into redirects-ssg
matthewp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| --- | ||
| 'astro': minor | ||
| --- | ||
|
|
||
| Experimental redirects support | ||
|
|
||
| This change adds support for the redirects RFC, currently in stage 3: https://github.com/withastro/roadmap/pull/587 | ||
|
|
||
| Now you can specify redirects in your Astro config: | ||
|
|
||
| ```js | ||
| import { defineConfig } from 'astro/config'; | ||
|
|
||
| export defineConfig({ | ||
| redirects: { | ||
| '/blog/old-post': '/blog/new-post' | ||
| } | ||
| }); | ||
| ``` | ||
|
|
||
| You can also specify spread routes using the same syntax as in file-based routing: | ||
|
|
||
| ```js | ||
| import { defineConfig } from 'astro/config'; | ||
|
|
||
| export defineConfig({ | ||
| redirects: { | ||
| '/blog/[...slug]': '/articles/[...slug]' | ||
| } | ||
| }); | ||
| ``` | ||
|
|
||
| By default Astro will build HTML files that contain the `<meta http-equiv="refresh">` tag. Adapters can also support redirect routes and create configuration for real HTTP-level redirects in production. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@astrojs/cloudflare': minor | ||
| --- | ||
|
|
||
| Support for experimental redirects | ||
|
|
||
| This adds support for the redirects RFC in the Cloudflare adapter. No changes are necessary, simply use configured redirects and the adapter will update your `_redirects` file. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| --- | ||
| '@astrojs/vercel': minor | ||
| --- | ||
|
|
||
| Support for experimental redirects | ||
|
|
||
| This adds support for the redirects RFC in the Vercel adapter. No changes are necessary, simply use configured redirects and the adapter will output the vercel.json file with the configuration values. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| '@astrojs/netlify': minor | ||
| --- | ||
|
|
||
| Support for experimental redirects | ||
|
|
||
| This adds support for the redirects RFC in the Netlify adapter, including a new `@astrojs/netlify/static` adapter for static sites. | ||
|
|
||
| No changes are necessary when using SSR. Simply use configured redirects and the adapter will update your `_redirects` file. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.