Replies: 10 comments 15 replies
-
Thank you! <3 |
Beta Was this translation helpful? Give feedback.
-
Thank you ! I was searching for a solution since hours 🙏 |
Beta Was this translation helpful? Give feedback.
-
Thanks for your help. I found a way to fix my issue. I just add this
line `trailingSlash: true` to file `next.config.js`. Let NextJS generate the index.html file for
each slug.
…On Tue, May 3, 2022 at 8:42 PM aki matsumoto ***@***.***> wrote:
I made the following changes and it works.
{- "destination": "/post/[slug].html",+ "destination": "/post/[slug]/index.html",
"regex": "^/post/([^/]+?)(?:/)?$"
}
—
Reply to this email directly, view it on GitHub
<#4980 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AARY36G6ENVJQS2OMCHVI6TVIEULVANCNFSM46CP4O7Q>
.
You are receiving this because you were mentioned.Message ID:
***@***.***
com>
--
Thanks & B. Regards,
Phuong Vo
Mobile App Developer
m:
0976071270
e:
***@***.***
|
Beta Was this translation helpful? Give feedback.
-
I have the same issue but this solution didn't work for me |
Beta Was this translation helpful? Give feedback.
-
You're a legend! |
Beta Was this translation helpful? Give feedback.
-
I managed to solve this by doing the following:
Here's the code.... all made by chat-gpt of course 😅 package.json
updateFirebaseRewrites.js
|
Beta Was this translation helpful? Give feedback.
-
Perfect, thank you 🙌 |
Beta Was this translation helpful? Give feedback.
-
thank you so much i just spent hours trying to figure this out!!! |
Beta Was this translation helpful? Give feedback.
-
This works! Thanks for sharing. Important:
Simply copy what you find in |
Beta Was this translation helpful? Give feedback.
-
Edit: Consider reading this comment first: #4980 (reply in thread)
Hi,
I just have to share another solution for using NextJS with firebase, that I haven't found on the web yet.
I have been using
next export
to create a static site and host it. However, this approach is missing dynamic routing, leading to 404 pages, when urls are shared.An alternative I have seen, is using a cloud function with custom nextjs server and routing, however it breaks my workflow with cloud functions and is therefore, not preferred.
Dynamic routing can be made possible easily however, by using firebase hosting rewrites. And instead of writing them on your own, you can easily copy pase them from your build nextjs page. Just go to
.next/routes-manifest.json
and copy the dynamic routes section. I.e.:and paste it to
firebase.json
rewrites and edit as follows:done!
Hope it will help some people.
Edit 03.05.2022:
If above rewrite does not work, maybe it works to add
/index
to the destination. Thanks to aki matsumoto for the hint!Beta Was this translation helpful? Give feedback.
All reactions