-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
netlify adapter docs: add warning on redirects file placement #1596
Conversation
This feels quite wrong to me. I'd rather put it at the root of the project. In neither case would we be putting it directly in the |
i see. so perhaps @roschaefer should reopen #1586 ? |
At least to me it feels quite intuitive putting it into So in my opinion this PR would do the trick. |
I went ahead and merged #1586. It shouldn't stop you from putting it in |
> [Netlify docs here](https://docs.netlify.com/routing/redirects/) | ||
|
||
Netlify supports declarative redirects via a `_redirects` file. Place it in the `static/` folder, NOT in your project root next to `netlify.toml`. | ||
|
||
During compilation a required "catch all" redirect rule is automatically appended to your `_redirects` file. (If it doesn't exist yet, it will be created.) That means: | ||
|
||
- `[[redirects]]` in `netlify.toml` will never match as `_redirects` has a [higher priority](https://docs.netlify.com/routing/redirects/#rule-processing-order). So always put your rules in the [`_redirects` file](https://docs.netlify.com/routing/redirects/#syntax-for-the-redirects-file). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just fyi - i think this is inaccurate - the doc actually says "Rules in the _redirects file are always processed first, followed by rules in the Netlify configuration file."
in other words you CAN put stuff in netlify.toml, AND in _redirects, its just that the latter overrides the former in cases of conflict.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it's true when you consider the catch-all route that gets added
Before submitting the PR, please make sure you do the following
addresses #1586 to hopefully save others from the same confusion