Next.js Discord

Discord Forum

How to use app router to use .html in the end for all the pages?

Unanswered
Cuvier’s Dwarf Caiman posted this in #help-forum
Open in Discord
Avatar
Cuvier’s Dwarf CaimanOP
for example-
1. parent.html
2. parent/child.html
3. parent/child/sub-child.html and so on

15 Replies

Avatar
risky
Is this for static export?
as unless trailing slash is enabled, it should do that
otherwise, i don't think you can do this for general server (without custom weidness like every route end with it)
Avatar
Clown
Unless its static export u cant.
Avatar
joulev
Rewrite requests ending with .html to corresponding pages without the .html
Avatar
Cuvier’s Dwarf CaimanOP
It's not static export.
Avatar
risky
ahh yeah that actually sounds smart
Avatar
Cuvier’s Dwarf CaimanOP
I tried creating a directory with category.html and for child category, created a separate directory category/
it worked but this is not a proper way so looking for a genuine way
Avatar
joulev
A proper way doesn’t exist
Unless you want to
app/category.html/page.tsx
app/category/settings.html/page.tsx
Avatar
Cuvier’s Dwarf CaimanOP
hmm ..then I have to go with customized routing only
can you provide further details for the same?
Avatar
joulev
app/category.html/page.tsx gives the /category.html route that’s all?
(category.html here is a folder not a file)