Skip to content
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

Redirects #7067

Merged
merged 49 commits into from
Jun 5, 2023
Merged
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
46e7269
Redirects spike
matthewp May 10, 2023
ef3ea94
Allow redirects in static mode
matthewp May 11, 2023
d6b7104
Support in Netlify as well
matthewp May 11, 2023
f52116a
Adding a changeset
matthewp May 11, 2023
a70820b
Rename file
matthewp May 11, 2023
475294a
Merge branch 'main' into redirects-ssg
matthewp May 19, 2023
eed6a72
Fix build problem
matthewp May 19, 2023
1749ce5
Refactor to be more modular
matthewp May 19, 2023
ab0539b
Fix location ref
matthewp May 19, 2023
83ed366
Late test should only run in SSR
matthewp May 19, 2023
e9e4d72
Merge branch 'main' into redirects-ssg
matthewp May 22, 2023
4857c7d
Support redirects in Netlify SSR configuration (#7167)
matthewp May 23, 2023
25d7d20
Implement support for dynamic routes in redirects (#7173)
matthewp May 23, 2023
11a517b
Merge branch 'main' into redirects-ssg
matthewp May 23, 2023
ffc771e
Implement support for redirects config in the Vercel adapter (#7182)
matthewp May 23, 2023
f55e422
Add support for the object notation in redirects
matthewp May 23, 2023
2904ced
Merge branch 'main' into redirects-ssg
matthewp May 23, 2023
c2f889b
Use status 308 for non-GET redirects (#7186)
matthewp May 24, 2023
af2ceea
Merge branch 'main' into redirects-ssg
matthewp May 24, 2023
8b4d248
Implement redirects in Cloudflare (#7198)
matthewp May 25, 2023
ef9a456
Test that redirects can come from middleware (#7213)
matthewp May 26, 2023
fa03a41
Implement priority (#7210)
matthewp May 30, 2023
02a8506
Merge branch 'main' into redirects-ssg
matthewp May 30, 2023
eb7617d
Refactor
matthewp May 30, 2023
d7d0b22
Fix netlify test ordering
matthewp May 30, 2023
fd52bd6
Merge branch 'main' into redirects-ssg
matthewp May 30, 2023
a39eb51
Fix ordering again
matthewp May 30, 2023
d3895a2
Redirects: Allow preventing the output of the static HTML file (#7245)
matthewp May 30, 2023
2700c12
Do a simple push for priority
matthewp May 30, 2023
60dcfb6
Adding changesets
matthewp May 30, 2023
c040279
Put the implementation behind a flag.
matthewp May 31, 2023
79263e3
Self review
matthewp May 31, 2023
5198529
Update .changeset/chatty-actors-stare.md
matthewp May 31, 2023
63b5cfa
Update packages/astro/src/@types/astro.ts
matthewp May 31, 2023
17d0538
Update packages/astro/src/@types/astro.ts
matthewp May 31, 2023
7b64d65
Update packages/astro/src/@types/astro.ts
matthewp May 31, 2023
cd8e703
Update packages/astro/src/@types/astro.ts
matthewp May 31, 2023
7fd2a0a
Update docs on dynamic restrictions.
matthewp May 31, 2023
42bfa65
Update packages/astro/src/@types/astro.ts
matthewp Jun 1, 2023
4da0c7b
Update packages/astro/src/@types/astro.ts
matthewp Jun 1, 2023
3eaf936
Code review changes
matthewp Jun 1, 2023
7c0905b
Document netlify static adapter
matthewp Jun 1, 2023
63210fe
Update packages/astro/src/@types/astro.ts
matthewp Jun 1, 2023
57e8105
Slight reword
matthewp Jun 1, 2023
131f9d2
Update .changeset/twenty-suns-vanish.md
matthewp Jun 1, 2023
afcc209
Add a note about public/_redirects file
matthewp Jun 1, 2023
4afaa37
Merge branch 'main' into redirects-ssg
natemoo-re Jun 1, 2023
303b79a
Update packages/astro/src/@types/astro.ts
matthewp Jun 1, 2023
33a9d5f
Merge branch 'main' into redirects-ssg
matthewp Jun 5, 2023
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
19 changes: 19 additions & 0 deletions packages/integrations/netlify/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,25 @@ export default defineConfig({
});
```

### Static sites

For static sites you usually don't need an adapter. However, if you use `redirects` configuration in your Astro config, the Netlify adapter can be used to translate this to the proper `_redirects` format.
matthewp marked this conversation as resolved.
Show resolved Hide resolved

```js
import { defineConfig } from 'astro/config';
import netlify from '@astrojs/netlify/static';

export default defineConfig({
adapter: netlify(),

redirects: {
'/blog/old-post': '/blog/new-post'
}
});
```

Once you run `astro build` there will be a `dist/_redirects` file. Netlify will use that to properly route pages in production.

## Usage

[Read the full deployment guide here.](https://docs.astro.build/en/guides/deploy/netlify/)
Expand Down