I have a javascript that does different things depending on the URL. for that to work, i need to have consistent URIs.
for example, i need users to always be on www.site.com/users/bob/
instead of www.site.com/users/bob
node unfortunately doesn't support that, as it seems.
i tried redirecting with
router.get('/:user', function(req, res) {
res.redirect('/users/' + req.params.user' + '/');
});
but it just results in a redirect loop, as the URL with and without slash seem to be treated as the same.
how can i do this? thanks!
edit:
i want to route from WITHOUT slash to WITH slash. the answers in the other question address the other way around. i can't .substr(-1) my URLs