Angelzzz
Angelzzz

Reputation: 1446

Next static html create wrong path for assets on nested pages

I have two types of pages in my Nextjs app:

 - index.html 
 -- admin/user.html
 -- admin/dashoard.html

In next.config.js I have

assetPrefix: "./",

When I run next build & next export I get static htmls with urls to assets like

<link rel="preload" href="./_next/static/css/47a9f0c415417b6241a6.css" as="style"/><link>

When I open page index.html it works well (path in html is out/_next/static/...) , but when I open admin/user.html I get 404 error, since it tries to get assets from out/admin/_next/static/...

How can it be solved by Nextjs or maybe Nginx?

Upvotes: 0

Views: 1053

Answers (1)

Angelzzz
Angelzzz

Reputation: 1446

Ok. I handled it using nginx, in next.config assetPrefix:''

Upvotes: 1

Related Questions