DEV Community

Cover image for How To Properly Deploy a Static HTML Site (built by Next.JS) on IIS to Avoid 404's

How To Properly Deploy a Static HTML Site (built by Next.JS) on IIS to Avoid 404's

Zafer Gurel on May 24, 2022

You can build your next.js project with the following command: npm run build Which in fact runs next build && next export (assuming build...
Collapse
 
lekansaheeddev profile image
Lekan Saheed • Edited

Hello, i tried this method, but only the next nested parent route after the '/' gets displayed. e.g localhost:50/dashboard, localhost:50/customers. If I route to localhost:50/customers/all and reload, i will get a 403. forbidden error. Is there a possible fix for this?

Collapse
 
zaff profile image
Zafer Gurel

Actually, it's been a while since I implemented this. But the trick is the match url part. It matches the whole part after the slash (/) character. So products become products.html. What you need to do is to change the regular expression. I'd like to give the exact solution but I don't have the setup anymore (switched to Linux :)).