I use a front-end entry form based on the official documentation (https://craftcms.com/docs/templating/entry-form), but after saving the entry, I am running in an error 404 on the entry page.
<input type="hidden" name="redirect" value="viewentry/{id}">
But if I replace the entry id with the slug in the browser (example.com/viewentry/example), then it works.