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

docs(netlify): clarify placement of _redirects file #870

Merged
merged 1 commit into from
Jan 25, 2023

Conversation

OlaAlsaker
Copy link
Contributor

πŸ”— Linked issue

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

@@ -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.
Copy link
Member

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?

Copy link
Contributor Author

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 πŸ˜„

Copy link
Contributor Author

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.

Copy link
Member

@pi0 pi0 Jan 25, 2023

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?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do ☺️

@pi0 pi0 changed the title docs: redirects in Netlify docs(netlify): clarify placement of _redirects file Jan 25, 2023
@pi0 pi0 merged commit 872a301 into unjs:main Jan 25, 2023
@OlaAlsaker OlaAlsaker deleted the patch-1 branch January 25, 2023 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants