Next.js index route returns 404
I got a problem to get my nextjs app running on my production server. I portforward it via htaccess by following code:
RewriteRule ^(.*) http://127.0.0.1:1338/$1
Every route is working perfectly: /blog,/blog/:id, /about etc.
Just "/" is not working when rendered from serverside. I can navigate to it after loading another route without any problem.
I can also call it by /index but not with mydomain.tld
Does anyone have an idea?
Solution 1:
The issue happens when Apache tries to pass an index.html file to the next router which returns an error.
Adding DirectoryIndex disabled
to .htaccess file solves the problem.
Solution 2:
You are trying to redirect using Apache Module but you seem to be using Node.js
Try looking at nodejs equivalent of this .htaccess