-
Notifications
You must be signed in to change notification settings - Fork 511
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
docs(netlify): clarify placement of _redirects
file
#870
Conversation
@@ -18,7 +18,7 @@ For new sites, Netlify will detect that you are using Nitro and set the publish | |||
|
|||
If you are upgrading an existing site you should check these and update them if needed. | |||
|
|||
If you want to add custom redirects, you can do so with [`routeRules`](/config#routerules) or by adding a [`_redirects`](https://docs.netlify.com/routing/redirects/#syntax-for-the-redirects-file) file. | |||
If you want to add custom redirects, you can do so with [`routeRules`](/config#routerules) or by adding a [`_redirects`](https://docs.netlify.com/routing/redirects/#syntax-for-the-redirects-file) file to your `public` directory. |
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.
Actually, I'd suggest to only mention the routeRules
here as it is a vendor-independent way for designing redirects which will work even when changing the deploy preset.
Any thoughts @pi0 @danielroe?
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.
In that case, routeRules
will need a more descriptive documentation. I tried routeRules
, but it did not solve the issue I had. I had to use _redirects
. Just bringing my thoughts π
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.
To be more precise: in my project, I have a completely separated SPA that lives in the public/admin
directory. As with other SPAs, I have to make a redirect rule that work like this:
/admin/* -> /admin/index.html
I tried using routeRules
for this, but did not succeed. I therefore ended up with the _redirects
file as a working solution, but it wasn't clear for me where to put file before I checked the actual source code of Nitro.
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'm pretty sure this can be achieved using route rules too. We can keep this as last resort (however consider the file might be overridden!)
Do you mind making a PR @manniL to recommend routeRules?
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.
Will do
_redirects
file
π Linked issue
β Type of change
π Description
π Checklist