Response.redirect returning the path

when trying to redirect a page it just sends the path as html.

if i were to redirect to the login page it would show “/login.ejs” instead of rendering the login html.

To render an ejs file use:
response.render(‘login’);

1 Like

yes but redirect just shows the redirected path as if i did response.send("/login.ejs").
I want to redirect not render, so it shows the correct url

redirect to say /login and then use app.get(‘login’) with response.render
E.G:

response.redirect('/login');
app.get('/login'  (request, response) => {
response.render('login');
})
1 Like
app.get("*.ejs", (req, res, next) => {
if(!req.cookies[".ASPXAUTH"] && req.path != "/login.ejs") return res.redirect("/login.ejs")
next()
})

That is the code that redirects, the login page works if juts go to the url

do return res.redirect('/login') instead return res.redirect('/login.ejs') and then use the get code I sent above the render

the path has .ejs so login wouldnt work, and it has been working, may have to do with the current glitch problems

@Cald-fan If you have a file with .ejs extension, and you have set the renderer to ejs, when you render the file, you don’t need to add the extension

Yeah I know. I just want to add it at the end