I'm trying to get my server to redirect to another page in my 'public folder'. When I use:
response.redirect(path.join(__dirname, '../public/user_home.html')) I get and error net::ERR_UNSAFE_REDIRECT
On the client side I have:
$.get( "/user_home", function( data ) {console.log(data)}; I can't find anything about this error. Am I going about this incorrectly?
22 Answers
Your public folder is already available if you have static middleware configured in your app.
app.use(express.static('public')) You can use:
res.redirect("/user_home.html"); response.redirect(path.join(__dirname, '../public/user_home.html'),safe=true) 0