4 ms·
Indeed it uses pages router, my point was more the timing because it has been posted recently while Lee Rob was tweeting about next export being reenabled (in 1
by eric-burel 3y ago
Indeed it uses pages router, my point was more the timing because it has been posted recently while Lee Rob was tweeting about next export being reenabled (in 13.4 I think).
For shalllow routing you are probably right (I don't use them much so I can't tell much, but I do have a few critics regarding app router too) but regarding rewrites, an URL rewrite has to happen in a server so I still don't get your point. What was removed in v13 is the shortcut via next.config.js not the ability to do rewrites/redirects which can be done easily using middlewares or whatever your host provides. It's also recommended to setup i18n yourself in a similar fashion instead of using the built-in config, something that I've been advocating for a long time (https://github.com/vercel/next.js/discussions/17631#discussioncomment-90912 https://github.com/vercel/next.js/discussions/17631#discussi...).
Gaeron example or the comments below show how to handle dynamic routes rewrites via nginx for instance.
- littlecranky67 3y agoRewrites and redirects do not need to be executed server-side ever since the html5 URL API. Of course you can redirect client-side, as in NextJS: router.push(). And given that redirects/rewrites work for the pages router also contradicts that point. But yes, you will need to add support within the webserver like nginx. A simple modification to `try_files` will do, and is probably present in most deployments anyway (because you will want URL routes like example.com/news instead of example.com/news.html). I think they just not considered that feature in the design of the app router. And I also don't think it is technically impossible to apply client-side redirects/rewrites within app router.